Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
having problems designing a query that pulls result set from any of four (4) tables in db.
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2009-06-07 : 02:56:56
If in understand you correctly, you can join queries from 4 tables using union all and then apply filter. some thing like,
SELECT fields...FROM(SELECT field1,filed2,field3,filed4,... FROM table1UNION ALLSELECT field1,filed2,field3,filed4,... FROM table2UNION ALLSELECT field1,filed2,field3,filed4,... FROM table3UNION ALLSELECT field1,filed2,field3,filed4,... FROM table4)tWHERE field4=@Yourparameter or search string