Re: select 3 characters

From: Richard Huxton <dev(at)archonet(dot)com>
To: "Cyber Join" <cyberjoin(at)linuxmail(dot)org>, pgsql-sql(at)postgresql(dot)org
Subject: Re: select 3 characters
Date: 2003-05-15 21:27:23
Message-ID: 200305152227.23542.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thursday 15 May 2003 9:05 pm, Cyber Join wrote:
> Hi I need select the first 3 characters from a table
>
> I try this but doesn't work
>
> "SELECT left(data,3) AS value FROM table;"
>
> i see the left function doesn't work what is the similar function in
> postgresql

It's called "substr":

richardh=# select substr('abcde',3);
substr
--------
cde
(1 row)

richardh=# select substr('abcde',1,3);
substr
--------
abc
(1 row)

--
Richard Huxton

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2003-05-15 21:28:15 Re: installation problem
Previous Message Josh Berkus 2003-05-15 20:58:27 Re: select 3 characters