View previous topic :: View next topic
|
Author |
Message |
aryanpa1
New User
Joined: 26 May 2007 Posts: 45 Location: Chennai
|
|
|
|
Hi ,
Can you please let me know if I can concatenate 3 columns(2 integer type and 1 char type) and the result of combination to be used as where condition of in sub query. It should be like below. I am getting error when I use the below query.
EX:
Code: |
Select * from table1
where
(column1 || column2 || Column3) not in
( Select (column1 || column2 || column3) from table1
where column4 not in ('A' , 'B')) with ur; |
|
|
Back to top |
|
|
Steve Davies
New User
Joined: 15 Oct 2009 Posts: 32 Location: UK
|
|
|
|
so post the error details aswell.......! |
|
Back to top |
|
|
bhairon singh rathore
New User
Joined: 19 Jun 2008 Posts: 91 Location: banglore
|
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
That is a terrible query.
You should never use
Code: |
where a !! b !! c in (select a !! b !! c ...) |
if you really want to use 'not in' you should write
Code: |
where (a,b,c) not in (select a,b,c ...) |
It is very likely that a correlated subselect is more performant.
Code: |
from table1 t1 where
not exists (select 1 from table1 t2 where ...
and t1.a = t2.a and t1.b = t2.b and t1.c=t2.c) |
|
|
Back to top |
|
|
|