Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
subhaoviya
Posting Yak Master
135 Posts |
Posted - 2012-07-12 : 08:55:40
|
| Hi, I have Maintable with columns C1, C2. and additionally having 3 tables as T_1, T_2, T_3 all the tables commonly having c1.I need to get the values of c1 from maintable which is not present in all other tables like T_1 and T_2 and T_3.I used the query Select MT.C1 from Maintable MTleft outer joinT_1 T1 on MT.C1=T1.C1left outer joinT_2 T2 on MT.C1=T2.C1left outer joinT_3 T3 on MT.C1=T3.C1where T1.C1 is null and T2.c1 is null and T3.c1 is null but i am not getting the exact result. |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2012-07-12 : 09:01:26
|
| That will give those values that are not in any of the other tables.Do you want that or those that are not in all - i which case replace "and" by "or" in the where clause.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
subhaoviya
Posting Yak Master
135 Posts |
Posted - 2012-07-12 : 09:11:38
|
| That query is working fine i forget to filter some values from columns, that's what i get wrong output.thanks friend |
 |
|
|
|
|
|