Re: left() in postgres

From: PD Miller <millerp(at)caribdata(dot)co(dot)uk>
To: Peter Nixon <listuser(at)peternixon(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: left() in postgres
Date: 2002-10-25 17:26:58
Message-ID: p05111b04b9df2e632d64@[192.168.0.2]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

At 20:14 +0300 25/10/02, Peter Nixon wrote:
>I guess I don't understand how to use it properly. can anyone give me some
>more help. When I fire off the following query (at a database of radius
>records)
>
>SELECT substring('CalledStationId' from 2 for 3) FROM calls WHERE
>h323connecttime BETWEEN DATE'YESTERDAY' AND (DATE'YESTERDAY' + INTERVAL'1
>min');

Change this:

SELECT substring('CalledStationId' from 2 for 3)
^ ^

to this:

SELECT substring(CalledStationId from 2 for 3)

In the example you have given, CalledStationID is a literal instead
of a column.

The syntax for substr would be:

SELECT substr(CalledStationId', 2, 3)

Regards

Paul Miller
--
-
Carib Data Limited

<mailto:millerp(at)caribdata(dot)co(dot)uk>
<http://www.caribdata.co.uk>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message liu 2002-10-25 17:49:40 Re: solved
Previous Message Stephan Szabo 2002-10-25 17:26:01 Re: left() in postgres