Link to home
Start Free TrialLog in
Avatar of Pete Winter
Pete WinterFlag for United Kingdom of Great Britain and Northern Ireland

asked on

SELECT DISTINCT on one column only

How do I select distinct only on one column.

Below is my current code...

$query_rs_media_new_group = "SELECT DISTINCT title, group_id, description, brand, weight, category, id FROM media_new";

Open in new window


My issue is that I need to select all the columns you see in my code. However I only want the "title" column to be DISTINCT.

What do I need to do?
Avatar of Daniel Wilson
Daniel Wilson
Flag of United States of America image

Would you provide some sample data and desired results?

Thanks!
Avatar of Pete Winter

ASKER

See sample data attached.

media-new.csv

You will notice in the data some of the "title" rows are the same. I only want to show the first unique "title".  So I should only see 8 of the 30 rows of data in the sample data.
ASKER CERTIFIED SOLUTION
Avatar of Daniel Wilson
Daniel Wilson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Many thanks