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 |
|
objkiran
Starting Member
11 Posts |
Posted - 2004-12-22 : 15:30:56
|
| a1 and a2 have same structure, but a1 has more records than a2. so, in order to find out how many records are missing in a2 the below query works. but is there a way to write the below query using joins.Select * from a1 where stoptime not in (select stoptime from a2)please |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-12-22 : 15:45:02
|
| Select a1.* from a1 left join a2on a2.stoptime = a1.stoptimewhere a2.stoptime is null==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
objkiran
Starting Member
11 Posts |
Posted - 2004-12-23 : 16:04:45
|
| can we write the below sql line using join to deleteDelete from a1 where a1.ID in (Select ID from a2) |
 |
|
|
objkiran
Starting Member
11 Posts |
Posted - 2004-12-23 : 16:21:33
|
| subquery comparing with joins. which is resoure intensitive and which would retrieve faster results. |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2004-12-23 : 16:24:26
|
| why don't you test them both and let us know what you find?- Jeff |
 |
|
|
|
|
|