I've got two tables:
login_log :: ip | etc.
ip_location :: ip | location | hostname | etc.
I want to get every IP address from login_log
which doesn't have a row in ip_location
.
I tried this query but it doesn't work:
SELECT login_log.ip
FROM login_log
WHERE NOT EXIST (SELECT ip_location.ip
FROM ip_location
WHERE login_log.ip = ip_location.ip)
ERROR: syntax error at or near "SELECT" LINE 3: WHERE NOT EXIST (SELECT ip_location.ip`
I'm also wondering if this query (with adjustments to make it work) is the best performing query for this purpose.
Aucun commentaire:
Enregistrer un commentaire