I'm looking for a way to select users from a user table that have at least one relating entry in another table. Probably my join approach is totally wrong but that is what I was trying and should give you an idea of the structure:
SELECT users.`id`, users.`email`, users.`username`, users.`status`, users.`date_reg`
FROM dir_editors as users
JOIN dir_links as links ON (links.`id_editor` = users.`id`)
WHERE COUNT(links.`id_editor`) > 1
So the goal is to get all these user data from user that have at least one link entry in the dir_links table where the id_editor is the field in the dir_links table.
Thanks for helping
SELECT users.`id`, users.`email`, users.`username`, users.`status`, users.`date_reg`
 FROM dir_editors as users
WHERE EXISTS(SELECT 1 FROM dir_links as links WHERE links.`id_editor` = users.`id`)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With