I have a query that worked when querying an access database but doesn't work when querying a MySQL database. I am basically trying to return all the rows from table1 that do not have a matching entry in table2:
SELECT T1.USR_ID,
T1.CO_NM
FROM DB2_USRS T1
WHERE NOT EXISTS (SELECT ' '
FROM DB2_CLIENT_DM T2
WHERE T1.USR_ID = T2.USR_ID
)
ORDER BY T1.CO_NM
I haven't done much SQL before so any thoughts here would be great! Why does this work in Access and not MySQL. Is there different syntax I need for MySQL?
Thanks!!!
SELECT T1.USR_ID,
T1.CO_NM
FROM DB2_USRS T1
WHERE NOT EXISTS (SELECT ' '
FROM DB2_CLIENT_DM T2
WHERE T1.USR_ID = T2.USR_ID
)
ORDER BY T1.CO_NM
I haven't done much SQL before so any thoughts here would be great! Why does this work in Access and not MySQL. Is there different syntax I need for MySQL?
Thanks!!!