pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Cyber Join <cyberjoin@linuxmail.org>
To: pgsql-sql@postgresql.org
Subject: Re: select 3 characters
Date: Thu, 15 May 2003 22:27:23 +0100
Message-ID: <200305152227.23542.dev@archonet.com> (raw)
In-Reply-To: <20030515200526.31852.qmail@linuxmail.org>
References: <20030515200526.31852.qmail@linuxmail.org>

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



view thread (5+ messages)  latest in thread

Message-ID: <200305152227.23542.dev@archonet.com>
Permalink:  ../200305152227.23542.dev@archonet.com/
Also on:    postgresql.org/message-id/200305152227.23542.dev@archonet.com

 · 

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: dev@archonet.com, cyberjoin@linuxmail.org
  Subject: Re: select 3 characters
  In-Reply-To: <200305152227.23542.dev@archonet.com>

* 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