php - Compare to tables in a mysql-database -


i've got 2 tables in mysql-database.

table "names":

id | name 100 | smith 136 | king 224 | brown 485 | miller 

and second table "adresses":

name_id | adress   100 | mainstreet 11 101 | hiddleburger street 33 102 | great avenue 1022 103 | panorama avenue 687 ... | ... 

in table "names" i've got 4 entries (id 100, 136, 224, 485). in table "adresses" i've got few hundret entries.

now want delete entries adresses have no matching names in table "names". want delete adress-entries, not name_id 100,136,224,485.

how can that? how can compare tables?

thank you!

not in , subquery. perhaps:

delete addresses name_id not in (select id names); 

performance may not good, work.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -