How is the right query for this condition ?

From: Bino Oetomo <bino(at)indoakses-online(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How is the right query for this condition ?
Date: 2009-11-23 01:47:00
Message-ID: 4B09E994.5010301@indoakses-online.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear All

Suppose I created a database with single table like this :
------start----------
CREATE DATABASE bino;
CREATE TABLE myrecords(record text);
------end------------

and I fill myrecords with this :
------start----------
COPY myrecords (record) FROM stdin;
1
12
123
1234
\.
------end------------

In my bash script, I have variable called 'vseek', that will be use for
query parameter.
How to query the table , for (i.e):

a. If vseek = '127' , I want the result is ==> '12'
b. if vseek = '123987' , I want the result is ==> '123'
c. if vseek = '14789' , I want the result is ==> '1'

Kindly please give me any enlightment

Sincerely
-bino-

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-11-23 02:16:39 Re: error linking with PostgreSQL
Previous Message Daniel 2009-11-23 01:03:02 error linking with PostgreSQL