Page 1 of 1

SQL DISTINCT

Posted: Tue Oct 03, 2006 4:49 pm
by aceconcepts
Hi,

I am trying to display a list of products ordered using php and mysql.

I want to be able to display a list of all product orders but not each individual product.

I am retrieving data from more than one table.

Can I do this by using DISTINCT? if so, how?

Thanks

Posted: Tue Oct 03, 2006 4:56 pm
by hawleyjr
What have you tried? Can we see your tables?

Posted: Tue Oct 03, 2006 5:20 pm
by aceconcepts
A better way of describing what I am trying to do is:

Can i use DISTINCT as follows -

Code: Select all

"SELECT * DICSTINCT product_id";
I want to select all fields but use distinct on just one of those fields.

Posted: Tue Oct 03, 2006 5:22 pm
by Burrito
you'd probably be better off using a GROUP BY clause and just grouping by the the one you want distinct.