I’m running the folowing query:
SELECT DISTINCT hardware_id, model, make from Table1 order by hardware_id;
My problem is that in the set of result, I want to see the results where only if hardware_id appears more than once.
Example:
hardware 1 model1 make 1
hardware 1 model2 make 1
hardware 2 model2 make 1 > I don’t want to see this because there’s only 1 occurence of hardware 2
hardware 3 model2 make 1
hardware 3 model2 make 1
Any idea how I can do this?
=====
The prob is that I can’t use the following query because of my DISTINCT Flag:
SELECT hardware_id,model,make from Table1 WHERE hardware_id IN (SELECT DISTINCT hardware_id, model, make from Table1 order by hardware_id) where count(hardware_id) >= 2;
I need absolutely to use distinct (hardware_id, model, make)
Any idea?
However this will select * random * values for
modelandmake.You might want to consider using:
You can also do a join against the first select to get all rows you need, you should not need distinct.