project42
02-25-2009, 05:41 PM
I have a 2 tables, customers and orders. I'm using phpMyAdmin and I need to do a SQL query that will output the database with the customers database but it needs to only display row with the date of the most recent order.
Heres a variation that I've been trying and it's still not coming out correctly.
SELECT DISTINCT orders.user_id, customers.*
FROM orders, customers
WHERE customers.id = orders.user_id
GROUP BY orders.id
I'm not using PHP to output this either. I'm just trying to output it in phpMyAdmin so I can then export the data.
Any help is appreciated.
Heres a variation that I've been trying and it's still not coming out correctly.
SELECT DISTINCT orders.user_id, customers.*
FROM orders, customers
WHERE customers.id = orders.user_id
GROUP BY orders.id
I'm not using PHP to output this either. I'm just trying to output it in phpMyAdmin so I can then export the data.
Any help is appreciated.