From: | James Kitambara <jameskitambara(at)yahoo(dot)co(dot)uk> |
---|---|
To: | Kenichiro Arakaki <inek883(at)gmail(dot)com> |
Cc: | pgsql-sql <pgsql-sql(at)postgresql(dot)org> |
Subject: | Fw: Re: help |
Date: | 2010-05-27 13:55:21 |
Message-ID: | 661576.31727.qm@web27907.mail.ukl.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
--- On Thu, 27/5/10, James Kitambara <jameskitambara(at)yahoo(dot)co(dot)uk> wrote:
From: James Kitambara <jameskitambara(at)yahoo(dot)co(dot)uk>
Subject: Re: [SQL] help
To: "Nicholas I" <nicholas(dot)domnic(dot)i(at)gmail(dot)com>
Date: Thursday, 27 May, 2010, 14:50
Hello Mr. Nicholas,
You can try the following:
THIS IS WHAT I TRIED TO SOLVE YOUR PROBLEM, BUT IN ORACLE DBMS
(SORRY I DON'T HAVE POSTGRESQL INSTALL ON MY COMPUTER)
i GUESS YOU CAN TRY TO CHANGE THE SQL COMMANDS IN POSTGRESQL
create table numbers (
id number not null primary key,
description varchar2(100)
);
insert into numbers values (300, 'Three hundred (300)');
insert into numbers values (350, 'Three hundred fifty (350)');
insert into numbers values (6709, 'Six thousand seven hundred and nine (6709)');
select id, description, substr(description, instr(description, '(') +1, instr(description, ')')-(instr(description, '(') +1)) extracted_character
from numbers;
This is the Results:
ID DESCRIPTION EXTRACTED_CHARACTERS
----------------------------------------------------------------------------------------------------------------
300 Three hundred 300
350 Tree hundred fifty 350
6709 Six thousand seven hundred and nine 6709
But if you run the following query you will get exactlly what:
select substr(description, instr(description, '(') +1, instr(description, ')')-(instr(description, '(') +1)) extracted_character
from numbers:
This is the Results:
EXTRACTED_CHARACTERS
-------------------------
300
350
6709
James Kitambara
B.Sc. With Computer Science and Statistics (Hons),
--- On Wed, 5/5/10, Nicholas I <nicholas(dot)domnic(dot)i(at)gmail(dot)com> wrote:
From: Nicholas I <nicholas(dot)domnic(dot)i(at)gmail(dot)com>
Subject: [SQL] help
To: pgsql-sql(at)postgresql(dot)org
Date: Wednesday, 5 May, 2010, 4:05
Hi,
I have a table in which the data's are entered like,
Example:
One (1)
Two (2)
Three (3)
I want to extract the data which is only within the parentheses.
that is
1
2
3
Thank You
Nicholas I
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2010-05-27 14:03:28 | Re: Question about slow queries... |
Previous Message | A. Kretschmer | 2010-05-27 12:45:15 | Re: Check set of date intervals |