Sunday, April 21, 2013

[SQL Server] Combining Multiple Tables Having Count

[SQL Server] Combining Multiple Tables Having Count


Combining Multiple Tables Having Count

Posted: 21 Apr 2013 01:32 AM PDT

Hello,I am trying to combine multiple tables, and then show only when value [Qry] when it is greater than 1 after combining the tables, below is what i wrote but not working.. thanks for your help in advanceselect [Dm],[Qry],[AP]from (select [DM],[Qry],[AP]from [dbo].[MyTable1]unionselect [DM], [Qry],[Ap]from [dbo].[MyTable2]unionselect [dm],[Qry],[Ap]from [dbo].[MyTable3]) as ALL_MY_Tableshaving count ([Qry])>1

No comments:

Post a Comment

Search This Blog