Jump to content

Join Help


schilly

Recommended Posts

I have a users and orders table. Both share the username field. I need to find all users who have no orders associated with their account.

 

I'm pretty sure it needs a join but I don't have much practise with them so some help is needed.

 

I'm guessing something like:

 

select * from users INNER JOIN orders ON users.username = orders.username where (SELECT sum(id) FROM orders WHERE users.username = orders.username) = 0

 

I'm not getting any errors but also getting no results.

 

Thx.

Link to comment
https://forums.phpfreaks.com/topic/189101-join-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.