Re: Is there anyway to do this?

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Wei Weng <wweng(at)kencast(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Is there anyway to do this?
Date: 2002-10-18 17:13:33
Message-ID: 20021018171333.GA26785@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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;

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Perrin 2002-10-18 17:53:19 Re: error...what to do?
Previous Message Ian Harding 2002-10-18 17:10:15 Re: Is there anyway to do this?