|
-
November 25th, 2003, 05:23 PM
#2
Member
As you know the value of k ( the number of entries ) it may be possible. However, the SLQ will not be efficient.
I think the way would be to link the table to itself multiple times. This would produce something like :
select t1.col1, t2.col2, t3.col2, t4.col2 from table t1, table t2, table t3, table t4
where t1.col1=t2.col1(+) and t2.col2='1'(+)
and t1.col1=t3.col3(+) and t3.col2='2'(+)
and t1.col1=t4.col1(+) and t2.col2='3'(+) ;
The (+), if you haven't met them, return null if the column doesn't exist.
I'm not entirely sure that this will work, although I have done similar things. Alternatively, the other columns can be returned as subqueries :
select t1.col1, (select table.col2 from table where table.col1=t1.col1 and table.col2='1'), etc.
Whichever, you have the problem of what to do if they don't return anything. You can leave them as null, or you can use a decode to convert the nulls to something more useful.
I hope this makes sense and is of use. Do let me know how you get on.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|