count

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Please help, this has to be simple and I'm over looking something..

All I want is to put 2 tables on one query and get a count of all unique.

Table 1 Table 2
Dan Joey
Joe Dan
Sam Rick

Results = 5

That's all, Please tell me this is simple. What I actually have to do is
much more complicated, but if I can get this step, I can handle the rest..

Please Reply, My deadline is today..

Thanks
 
SELECT Count(*) AS TheCount
FROM (SELECT TheName FROM Table1 UNION SELECT TheName FROM Table2)
 
BTW: In case it is not obvious - the default behaviour of a union query is
to return only unique records ...
 
Try:

SELECT Count(*) AS UniqueCount
FROM (SELECT * FROM Table1 UNION SELECT * FROM Table2) AS UniqueRows;
 
Back
Top