Re: How to write this QUERY
From: Shahzad Latif <shai_02_at_hotmail.com>
Date: 25 Dec 2001 09:25:44 -0800
Message-ID: <1f16721b.0112250925.62a73190_at_posting.google.com>
Date: 25 Dec 2001 09:25:44 -0800
Message-ID: <1f16721b.0112250925.62a73190_at_posting.google.com>
> (1) ID_STR and PRIORITY from A
Select * from A
> (2) TITLE From concerned table based on the ID_STR (first two chars
> signify the table eg KK points to T2 followed by three digit > ID)
Select title from
A, (select id, title, 'JJ' as code from T1
union
select id, title, 'KK' as code from T2
union
select id, title, 'LL' as code from T3) B
where
substr(A.id_str,1,2) = B.code (+)
and to_number(substr(A.id_str,3,length(A.id_str))) = B.id (+)
I didn't test the query, but you can get the idea. (+) is to take care of all your nulls. Remove it if you dont want to see nulls. Secondly, confirm the parameters of "substr".
Shahzad Received on Tue Dec 25 2001 - 18:25:44 CET