|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Oracle join
Hi
I am working in Oracle 8i. I have two tables T1(C1,C2) and T2(C1,C3,C4) with T1.C1 = T2.C1. I need to find all C1's from T1 where T1.C1 = T2.C1 and T2.C3 contains a list of values. Is it possible to get it in single query? Note: all the values in the list should be present in T2.C3 Regards Sathish.B |
|
#2
|
|||
|
|||
|
Sorry, its T2.C3
Quote:
|
|
#3
|
|||
|
|||
|
select T1.C1 from T1, T2 where
T1.C1 = T2.C1 and T2.C3 is not null |
|
#4
|
|||
|
|||
|
ur query will return whichever is not null. i want something like this...
select T1.C1 from T1,T2 where T1.C1=T2.C1 and T2.C3 in ('X','Y') the value T1.C1 should have both X,Y mapped in T2.C1, but the query above gives T1.C1 even if it is mapped to either of X or Y. |
|
#5
|
|||
|
|||
|
How do you store data into table?? could you please provide some data?
|
|
#6
|
|||
|
|||
|
If the table data is like this...
T1-----------T2 C1---C2------C1-------C3-------C4 1-----A-------1--------X-------ABC 2-----B-------1--------Y-------123 --------------1--------Z-------XYZ --------------2--------X-------123 my join is T1.C1=T2.C1 and T2.C3 should contain both X and Y. so my output will be only "1". if i use T2.C3 in ('X','Y') I am getting both "1" and "2". have used - instead of tab. |
|
#7
|
|||
|
|||
|
select T1.C1 from T1,T2 t21,T2 t22
where T1.C1=T21.C1 and T1.C1=T22.C1 and T21.C3 ='X' and T22.C3 ='Y' |
|
#8
|
|||
|
|||
|
Thanks for the query, but if I need to check 10 values(X,Y,A,B,C,Z,.....), then should I have to implement 10 joins? if I do so, will it not shoot the server performance?
Regards Sathish.B |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Oracle join |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|