pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Wei Weng <wweng@kencast.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Is there anyway to do this?
Date: Fri, 18 Oct 2002 12:13:33 -0500
Message-ID: <20021018171333.GA26785@wolff.to> (raw)
In-Reply-To: <1034959557.27181.3.camel@Monet>
References: <1034959557.27181.3.camel@Monet>

On Fri, Oct 18, 2002 at 12:45:56 -0400,
  Wei Weng <wweng@kencast.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;



view thread (3+ messages)

Message-ID: <20021018171333.GA26785@wolff.to>
Permalink:  ../20021018171333.GA26785@wolff.to/
Also on:    postgresql.org/message-id/20021018171333.GA26785@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, wweng@kencast.com
  Subject: Re: Is there anyway to do this?
  In-Reply-To: <20021018171333.GA26785@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox