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 |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2007-06-05 : 05:00:25
|
| How can i modify my sql query to retrieve the records in table h which are not present in table f ?select h.LimCodeFieldID, h.FixingDate, h.FixingValue, h.CreatedDate, h.CreatedUser from tblLimCodesFixingsDailyHistory h inner join tblLimCodesFixings f on (h.LimCodeFieldID = f.LimCodeFieldID) and (h.FixingDate = f.FixingDate) |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-06-05 : 05:02:47
|
| Like this??fromtblLimCodesFixingsDailyHistory h LEFT OUTER join tblLimCodesFixings f on (h.LimCodeFieldID = f.LimCodeFieldID) and(h.FixingDate = f.FixingDate)WHERE f.LimCodeFieldID IS NULL Kristen |
 |
|
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2007-06-05 : 05:06:52
|
quote: Originally posted by Kristen Like this??fromtblLimCodesFixingsDailyHistory h LEFT OUTER join tblLimCodesFixings f on (h.LimCodeFieldID = f.LimCodeFieldID) and(h.FixingDate = f.FixingDate)WHERE f.LimCodeFieldID IS NULL Kristen
many thanks |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-06-05 : 09:33:15
|
| You can also use not existsselecth.LimCodeFieldID,h.FixingDate,h.FixingValue,h.CreatedDate,h.CreatedUserfromtblLimCodesFixingsDailyHistory h where not exists(select * from f where LimCodeFieldID = h.LimCodeFieldID and FixingDate = h.FixingDate)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|