Access Query - HELP!

Status
Not open for further replies.

Trompeta

Wise, Aged Ars Veteran
128
Basically I have a table with 3 columns,
1- PrimaryKey
2- Item
3- Value

I need a query that will show me where the Item has different values. For example if this is part of the table:

code:<HR>
Code:
1  Chair   20
2  Window  5
3  Chair   10
4  Window  5
5  Window  5
5  Chair   20

The query should return:

code:<HR>
Code:
1  Chair   20
3  Chair   10
5  Chair   20

Can anyone help with this?

Thanks in advance.
Trompeta
juancho_trompeta@yahoo.com
 

Universe Man

Ars Scholae Palatinae
1,464
Subscriptor
Try:

SELECT a.* from tablename a join tablename b on a.item = b.item
WHERE a.value <> b.value

I haven't tried this, but I think it should work.

Good luck.

Edit: It will work, but change it to:
code:<HR>
Code:
SELECT DISTINCT a.* from tablename a join tablename b on a.item = b.item
WHERE a.value <> b.value

To avoid getting duplicates.
 
Status
Not open for further replies.