[SOLVED] SQL Distinct
Posted: Fri Jul 02, 2004 5:46 am
Hi all,
The above returns my latest software release for a particular product.
Now I have never really gone beyond the SELECT title, date FROM etc type of SQL statments.
I have noticed that I (because I don't know how) cannot get to the other fields in the table. For instance, I tried to do this:
So I would get a list of the latest releases showing their title and release date. But obviously this does nto work.
Could someone please advise me on how to achieve this?
Code: Select all
$sql = "SELECT DISTINCT product FROM downloads ORDER BY release_date";Now I have never really gone beyond the SELECT title, date FROM etc type of SQL statments.
I have noticed that I (because I don't know how) cannot get to the other fields in the table. For instance, I tried to do this:
Code: Select all
$sql = "SELECT DISTINCT product, title, DATE_FORMAT(release_date,'%d/%m/%Y') as formatted_release_date FROM downloads ORDER BY release_date";Could someone please advise me on how to achieve this?