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 query

Author  Topic 

esambath
Yak Posting Veteran

89 Posts

Posted - 2008-08-20 : 06:15:33
Dear friends,

I have one table name there is View_product

For a single Item i may be have a more than one description
so I want to display the Item,Description on that which Item have more than one Description



Table Name: View_product

ID ESOID Location Quantity Item Description
1 3 1-Laundry 1 222B26 AAA
2 3 1-Basement 1 222B26 AAA
3 3 1-Family Entry 1 193-26 CCC
4 4 1-Office 1 2340-625 BBB
5 4 2-Studio 1 2340-625 BBB
6 4 2-Master 1 2340-625 BBB
7 6 2-Hall Closet 1 193-26 CCC


Output

Item Description
222B26 AAA
AAA
2340-625 BBB
BBB
BBB
193-26 CCC
CCC

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-08-20 : 06:18:20
select t1,* from View_product as t1 inner join
(
select item from View_product group by item having count(*)>1
) as t2 on t1.item=t2.item


Madhivanan

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

- Advertisement -