Distinct rows but all columns?
Is there a way to make a SQL statement that will only return distinct rows but ALL columns?
I have a table somehow like this:
ORDER CUSTOMER ORDER DATE
1 1010 05/04/2005
1 1010 05/04/2005
2 1011 05/09/2005
3 1010 05/10/2005
I want to filter maybe by order number and put the results in a listview control like this:
ORDER CUSTOMER ORDER DATE
1 1010 05/04/2005
2 1011 05/09/2005
3 1010 05/10/2005
I guess I'm thinking of a query like:
"SELECT ALL customer, orderdate DISTINCT order FROM table..." but this of course is wrong. Any help will be appreciated.
Re: Distinct rows but all columns?
I think the query should go along the lines of...
"SELECT customer, orderdate DISTINCT order FROM table..."
That should select them all if I am correct :)
Cheers,
RyanJ
Re: Distinct rows but all columns?
Thanks for your quick response but it doesn't work, gives me the error message:
runtime error '3075'
Syntax error (missing operator) in query expression ...
Any other idea?
Re: Distinct rows but all columns?
Quote:
Originally Posted by chiefo
Thanks for your quick response but it doesn't work, gives me the error message:
runtime error '3075'
Syntax error (missing operator) in query expression ...
Any other idea?
In that case I ahve no idea, but the MySQL Manual may help you :)
Cheers and sorry I could be of no more help :(
RyanJ
Re: Distinct rows but all columns?
Thanks for your interest Ryan, cheers.
Re: Distinct rows but all columns?
You need to place the distinc after select like this:
Code:
SELECT DISTINCT `customer`, `orderdate` `order` FROM table;