If i wanted to display only the unique values in a database, how would i go about it. I have a database of customer sales. if some one buys more than one item each item gets there own entry in the database with there order number. I want to be able to list all of the order numbers and have the number of entries displayed for them. Example
ordernum (#of Trans.) 20030916532 (2) 20030916602 (4) 20030916777 (1)
how would i go about doing this
Not sure of the table and column names, but this should give you the idea.
select order_numbers, count(*) as items from mySales group by order_numbers
thank you for your help, but i think i should have mentioned that i have
$result = mysql_query("SELECT * FROM sales WHERE Statues = 'Open' or Statues = 'Hold' ORDER BY Date,OrderNum",$db);
where would i sneak in the new query?