Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to display non duplicate data from ONE table

Status
Not open for further replies.

metaman

Programmer
Mar 17, 2006
9
NO
I have on table with the following data:
Item Qty
Pencil 12
Eraser 3
Pencil 5
Pencil 4
Pen 3
Paint 3
Pen 3

I want to list out both Item and Qty but only the rows where the Item is not duplicated. The desired result will be:

Pencil 12
Eraser 3
Pen 3
Paint 3
 
Are you sure uou don't wanted this ?
SELECT Item, SUM(Qty) FROM yourTable GROUP BY Item

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
No this is not what I wanted but thanks for the effort. I want something like:

SELECT Item, Qty
FROM MyTable
WHERE Item = (SELECT DISTINCT Item FROM MyTable)

but this does not work
 
And which Qty field you want ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
It does not mater which qty field, the first occurance is good enough
 
SELECT Item, Min(Qty) FROM yourTable GROUP BY Item

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
This Is just what I wanted thanks a lot, m8
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top