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 |
|
mapidea
Posting Yak Master
124 Posts |
Posted - 2009-09-05 : 22:33:49
|
| I want to get the list of columns from first table and Subtract that recordset from the second table which match (three columns)SELECT tb_video.external_video_thumbnail_url, tb_video.external_video_processedFROM tb_profile_feature_entry tb_entry INNER JOIN tb_profile_feature_entry_video tb_video on tb_entry.entry_id=tb_video.entry_id AND tb_entry.feature_id=tb_video.feature_id AND tb_entry.user_id=tb_video.user_id --Till Here the query is fine--Now here there are three columns entry_id user_id and feature_id if all the three values match in the tb_entry and tb_profile_feature_entry_vote table that record should not be displyed. How can I modify this query to get the correct result where tb_entry.entry_id not in(select entry_id from tb_profile_feature_entry_vote where voter_id =@voter_id) AND tb_entry.user_id not in(select user_id from tb_profile_feature_entry_vote where voter_id =@voter_id) AND tb_entry.feature_id not in(select feature_id from tb_profile_feature_entry_vote where voter_id =@voter_id) |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-09-06 : 13:53:18
|
| [code]SELECT tb_video.external_video_thumbnail_url,tb_video.external_video_processedFROM tb_profile_feature_entry tb_entry INNER JOIN tb_profile_feature_entry_video tb_video on tb_entry.entry_id=tb_video.entry_id AND tb_entry.feature_id=tb_video.feature_id AND tb_entry.user_id=tb_video.user_idLEFT JOIN tb_profile_feature_entry_vote vON tb_entry.entry_id=v.entry_id AND tb_entry.feature_id=v.feature_id AND tb_entry.user_id=v.user_idAND v.voter_id =@voter_idWHERE v.entry_id is null[/code] |
 |
|
|
mapidea
Posting Yak Master
124 Posts |
Posted - 2009-09-06 : 14:28:50
|
| Thanks Visakh |
 |
|
|
|
|
|