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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Query results aggregation

Author  Topic 

fcoury
Starting Member

2 Posts

Posted - 2008-06-04 : 18:33:10
I think this problem is classic - I am pretty sure I saw this one somewhere else but can't seem to find an easy solution.

I hava data on tables that goes like this (in SQL2k):


id family_id attribute_value_id
--- --------- ------------------
1 1 1
2 1 2
3 1 3
4 1 4
5 1 5
6 2 1
7 2 2
8 2 3
9 2 5


What I need to determine is, given a set of attribule_value_id's, what is the family_id. Please note that (1,2,3,5) should return 2 while (1,2,3,4,5) should return 1 and (1,2,3,4) should return NULL.

Is there an easy way to achieve that?

Any thoughts, suggestions and comments are more than welcomed.

Thanks in advance,
Felipe Coury

soorajtnpki
Posting Yak Master

231 Posts

Posted - 2008-06-05 : 00:27:06
hi
can u pls post ur expected output too for above data..

ok tanx...
Go to Top of Page
   

- Advertisement -