[sql] sql: check if entry in table A exists in table B