From: | "Ian Harding" <ianh(at)tpchd(dot)org> |
---|---|
To: | <wweng(at)kencast(dot)com>, <bruno(at)wolff(dot)to> |
Cc: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Is there anyway to do this? |
Date: | 2002-10-18 17:10:15 |
Message-ID: | sdafde4f.055@mail.tpchd.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
MSSQL Server does not recognize this syntax, but it does accept
select distinct substring(username, 1, 1)
Ian A. Harding
Programmer/Analyst II
Tacoma-Pierce County Health Department
(253) 798-3549
iharding(at)tpchd(dot)org
>>> Bruno Wolff III <bruno(at)wolff(dot)to> 10/18/02 10:13AM >>>
On Fri, Oct 18, 2002 at 12:45:56 -0400,
Wei Weng <wweng(at)kencast(dot)com> wrote:
> I have a table
>
> Table "Users"
> Column | Type | Modifiers
> -----------+------------------------+-----------
> userid | character varying(40) | not null
> username | character varying(64) |
>
> 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.
>
> 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?
From | Date | Subject | |
---|---|---|---|
Next Message | Bruno Wolff III | 2002-10-18 17:13:33 | Re: Is there anyway to do this? |
Previous Message | Martin Crundall | 2002-10-18 16:59:10 | Re: TRIGGERed INSERTS |