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 |
|
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2006-02-16 : 14:20:33
|
| how can i make union on 2 tables and add a where condition that will effect both of them?beacuse if i doselect * from table1union allselect * from table2where id>5the where effects only the second select!what to do?thnaksi nadvancepelegIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-02-16 : 14:48:05
|
| Suggestion 1.select * from table1 where id>5union allselect * from table2 where id>5Suggestion 2.Select ID, field1,... from(select ID, field1,... from table1union allselect ID, field1,... from table2) as UnionQrywhere id > 5 |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-02-17 : 02:24:35
|
| First approach is correct way to go.MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|