I'm hoping you can point me in the general direction of what I need to do.
I've got 2 tables (abbreviated):
orders: order_id, id, sessionid
products: id, title, ref
What I need is a select query which will pull all the info from both but display only one row per orders.id.
I think I need to use DISTINCT but I've read that it doesn't work with JOINs - is there a way of doing a subquery to pull the rest of the information out?
I know this is wrong but something like:
Does that make any sense?PHP Code:
SELECT DISTINCT orders.id (SELECT orders.sessionid, products.id, products.title from orders, products) WHERE sessionid='$sessionidnow'
Any suggestions welcomed!