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.
| Author |
Topic |
|
Mageshkumar
Starting Member
29 Posts |
Posted - 2008-07-17 : 07:59:30
|
| Hi i have two tablesI have to compare this 2 tables...,Now which dates are not in table1 that date and that ename have to come in select statement Table1:TSID TSdate EName100 7-21-2008 Name1101 7-21-2008 Name1102 7-22-2008 Name1103 7-26-2008 Name1104 7-23-2008 Name2105 7-25-2008 Name2Table2:Nodates7-21-20087-22-20087-23-20087-24-20087-25-20087-26-2008output:Date Name7-23-2008 Name17-24-2008 Name17-25-2008 Name17-21-2008 Name27-22-2008 Name27-24-2008 Name27-26-2008 Name2how to do that |
|
|
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts |
Posted - 2008-07-17 : 08:11:23
|
Here's one way...select * from (select distinct EName from Table1) a cross join Table2 bwhere not exists (select * from Table1 where TSdate = b.TSdate and EName = a.EName) Ryan Randall Solutions are easy. Understanding the problem, now, that's the hard part. |
 |
|
|
Mageshkumar
Starting Member
29 Posts |
Posted - 2008-07-17 : 08:26:58
|
| Thank u RyanRandall...,Thanks lot |
 |
|
|
|
|
|