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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Comparing 2 tables

Author  Topic 

mike1973
Starting Member

46 Posts

Posted - 2010-12-13 : 02:38:59
Hello guys,

i have 2 tables T1, T2 with the same structure in columns but may differ in rows. The structure is the following:
ID, CompanyID, YearID, MonthID, EmpID, Total

My Question is how i can find the common rows Where
T1.Company=T2.Company AND
T1.YeardID=T2.YearID AND
T1.MonthID=T2.Month AND
T1.EmpID=T2.EmpID

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-12-13 : 03:29:33
Is this ?
Select T1.* from
T1, T2 Where
T1.Company=T2.Company AND
T1.YeardID=T2.YearID AND
T1.MonthID=T2.Month AND
T1.EmpID=T2.EmpID
Go to Top of Page
   

- Advertisement -