VegasL (4/21/2013)
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 advance
select [Dm],[Qry],[AP]
from
(select [DM],[Qry],[AP]
from [dbo].[MyTable1]
union
select [DM], [Qry],[Ap]
from [dbo].[MyTable2]
union
select [dm],[Qry],[Ap]
from [dbo].[MyTable3]
) as ALL_MY_Tables
having count ([Qry])>1
uneducated guess....
SELECT dm, COUNT(qry) AS Expr1
FROM (SELECT dm, qry
FROM MyTable1
UNION
SELECT dm, qry
FROM MyTable2
UNION
SELECT dm, qry
FROM MyTable3) AS x
GROUP BY dm
HAVING (COUNT(qry) IS NOT NULL)
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day