basic distinct query help..

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Frozenlight777
Forum Commoner
Posts: 75
Joined: Wed May 28, 2008 12:59 pm

basic distinct query help..

Post by Frozenlight777 »

I have the following query....

Code: Select all

select distinct(system_id_number), system_name, net_user_name from system where system_model LIKE '%2cu%' order by system_name
I keep getting multiple system_id_numbers of the same values. I'm either using distinct incorrectly or there's another method. How can I assure that each system_id_number is unique?

Danke
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: basic distinct query help..

Post by Christopher »

It is doing DISTINCT on all of the fields as a group. Look at GROUP BY instead. They are confusingly similar....
(#10850)
Post Reply