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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-02-26 : 07:52:26
|
| Roksana writes "I have 2 tables. Tab1 has list of stores & the product it carries. Tab2 is the master product list. When I compare the two tables I want only Store# 1 to be returned in the result set as it matches the complete & exact set of tab2. Example:Tab1 Tab2Str#Prod Prod1 A A1 B B1 C C2 A 2 B2 DThanks." |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-02-26 : 09:01:43
|
| See INNER JOIN in Books Online. If this is a student, we don't answer homework questions here.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
claire
Starting Member
19 Posts |
Posted - 2004-02-26 : 09:19:32
|
| That's fine, we all started as a student, no need of being so strictTry this, though there might be better wayselect Str# from tb1 inner join tb2 on tb1.prod = tb2.prod group by Str# having count(Str#) = (select count(Prod) from tb2) |
 |
|
|
|
|
|