Created
September 3, 2014 14:52
-
-
Save oak-tree/9f710374d33fbb2caf03 to your computer and use it in GitHub Desktop.
select all records that doesn't have relation to another table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT rp.report_id, rp.project_id, rp.project FROM `reports_projects` as rp where rp.project not in (select p.CODE from projects as p) limit 50 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
another options
select rp.report_id,rp.project from
reports_projectsas rp LEFT JOIN projects as p ON (rp.project = p.code)where p.code is NULL