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)
 Grouping Query

Author  Topic 

KabirPatel
Yak Posting Veteran

54 Posts

Posted - 2008-07-03 : 06:40:20

Hi,

I have a table as follows:

UserID | ControlName | Hide
----------------------------
1 ControlA 1
1 ControlB 1
1 ControlC 0
1 ControlD 1
2 ControlA 0
2 ControlB 0
2 ControlC 1
2 ControlD 1
3 ControlA 1
3 ControlB 1
3 ControlC 0
3 ControlD 1

etc.....

I need to group UserID's together where the "Hide" value of each control is the same. In other words, in the above table UserID 1 and 3 are identical whereas UserID 2 is not.

How do I group these users together?

Thanks in advance.
Kabir


khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-03 : 07:46:46
How do you want the result like ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

KabirPatel
Yak Posting Veteran

54 Posts

Posted - 2008-07-03 : 08:47:39

Hi,

I dont really mind as long as it's easy to tell which user's belong together.

e.g.

UserID GroupID
----------------------------
1 1
3 1
2 2

etc...
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-03 : 09:01:23
is the ControlName limit to 4 or it can be any number ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

KabirPatel
Yak Posting Veteran

54 Posts

Posted - 2008-07-03 : 09:10:49

Its set to four.

Thanks,
KP
Go to Top of Page
   

- Advertisement -