Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 7BEA4476980 for ; Fri, 18 Oct 2002 13:11:59 -0400 (EDT) Received: from mail.tpchd.org (unknown [192.103.155.40]) by postgresql.org (Postfix) with SMTP id 6C28F47695F for ; Fri, 18 Oct 2002 13:11:58 -0400 (EDT) Received: from TPC-Message_Server by mail.tpchd.org with Novell_GroupWise; Fri, 18 Oct 2002 10:11:27 -0700 Message-Id: X-Mailer: Novell GroupWise Internet Agent 5.5.2.1 Date: Fri, 18 Oct 2002 10:10:15 -0700 From: "Ian Harding" To: , Cc: Subject: Re: Is there anyway to do this? Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/223 X-Sequence-Number: 9940 MSSQL Server does not recognize this syntax, but it does accept=20 select distinct substring(username, 1, 1) Ian A. Harding Programmer/Analyst II Tacoma-Pierce County Health Department (253) 798-3549 iharding@tpchd.org >>> Bruno Wolff III 10/18/02 10:13AM >>> On Fri, Oct 18, 2002 at 12:45:56 -0400, Wei Weng wrote: > I have a table=20 >=20 > Table "Users" > Column | Type | Modifiers=20 > -----------+------------------------+----------- > userid | character varying(40) | not null > username | character varying(64) |=20 >=20 > I want to get all the distinct first character of all usernames. And do > it in a way that is the most portable to MS SQL server. >=20 > Is there anyway? Looking through the documentation on string functions would be helpful. An example solution is: select distinct substring(username from 1 for 1) from users; ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org