Groups | Blog | Home
all groups > sql server clients > april 2004 >

sql server clients : Query syntax for count comparison


Ysandre
4/30/2004 12:51:02 PM
I have 2 tables, with 2 columns each: Seq# and Client
I need the syntax of a query to compare count(Client) by Seq#, between Table1 and Table2

Something like this (although this doesn't work)
Select Table1.Seq
from Table1 inner join Table2 on Table1.Seq# = Table2.Seq
where count (table1.Client) = count (table2.Client

Is this possible? If so, please provide correct syntax
Thank you
Narayana Vyas Kondreddi
5/2/2004 9:17:25 AM
It would be easier for us to understand your requirement, if you posted some
sample data to work with, and the expected resultset.
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm




[quoted text, click to view]
I have 2 tables, with 2 columns each: Seq# and Client.
I need the syntax of a query to compare count(Client) by Seq#, between
Table1 and Table2.

Something like this (although this doesn't work):
Select Table1.Seq#
from Table1 inner join Table2 on Table1.Seq# = Table2.Seq#
where count (table1.Client) = count (table2.Client)

Is this possible? If so, please provide correct syntax.
Thank you!


Anith Sen
5/3/2004 12:44:29 PM
Take a look at FULL OUTER JOIN in SQL Server Books Online. In simple cases
similar to yours, one can use it to compare data across different tables.

--
Anith

AddThis Social Bookmark Button