Quantcast
Channel: SQL find where two tables does not match (combined key) - Stack Overflow
Browsing latest articles
Browse All 4 View Live

Answer by Thorsten Kettner for SQL find where two tables does not match...

You are looking for a NOT IN (or NOT EXISTS) clause: records from one table that have no match in another:select * from user_has_academy_modulewhere (user_id, academy_team_id) not in (select user_id,...

View Article



Answer by stravanato for SQL find where two tables does not match (combined key)

Try this:SELECT m.* FROM user_has_academy_module AS m LEFT JOIN user_has_academy_team as t ON m.user_id = t.user_id AND m.academy_team_id = t.academy_team_id WHERE t.user_id IS NULLThat's how it works:...

View Article

Answer by e4c5 for SQL find where two tables does not match (combined key)

SELECT a.* FROM user_has_academy_team aLEFT JOIN user_has_academy_module b ON a.user_id = b.user_id AND a.academy_team_id = academy_team_idWHERE b.user_id IS NULL or b.academy_team_id IS NULLShould...

View Article

SQL find where two tables does not match (combined key)

I have the following two tables:Table: user_has_academy_teamColumns:user_id int(11) PKacademy_team_id int(11) PKtimestamp datetimeTable: user_has_academy_moduleColumns:id int(11) AI PKuser_id...

View Article
Browsing latest articles
Browse All 4 View Live




Latest Images