pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nuchanard Chiannilkulchai <nuch@valigene.com>
To: pgsql-sql@hub.org
Subject: substring
Date: Mon, 26 Apr 1999 16:57:05 +0200
Message-ID: <37247EC0.AA67A0F5@valigene.com> (raw)

Hello,

    How should I do my query to put a substring value in a field, in
postgres ( I have 6.4) ?

I have  in table table_a
a
----------------
98-004_c136
P124_154
98-005_c171

and i want to select only the text before the underscore:

in sybase, this should be
 select a, substring(a,1,charindex('_',a)-1)  from table_a
 a
 ---------------- ----------------
 98-004_c136      98-004
 98-005_c171      98-005
 P124_154         P124

    Thanks a lot,
    Nuch






view thread (22+ messages)  latest in thread

Message-ID: <37247EC0.AA67A0F5@valigene.com>
Permalink:  ../37247EC0.AA67A0F5@valigene.com/
Also on:    postgresql.org/message-id/37247EC0.AA67A0F5@valigene.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: nuch@valigene.com, pgsql-sql@hub.org
  Subject: Re: substring
  In-Reply-To: <37247EC0.AA67A0F5@valigene.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