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
 General SQL Server Forums
 New to SQL Server Programming
 Select help

Author  Topic 

chicosqlhack
Starting Member

4 Posts

Posted - 2006-06-23 : 16:08:52
I have a table (inv_loc) with three columns of data: item_id, location_id and product_group_id. I'd like to return all rows where the item_id is the same but where the product_group_id differs, regardless of the location.

I've tried to select rows where the item_id = item_id and product_group_id<>product_group_id, but I'm not returning any data.

chicosqlhack
Starting Member

4 Posts

Posted - 2006-06-23 : 16:56:39
I didn't consider grouping the items; I can do a distinct count of the product groups and select any items with more than 1.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-06-23 : 19:36:18
can you explain what do you mean by "return all rows where the item_id is the same" ?


KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-06-26 : 01:43:08
Post some sample data and the result you want

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -