-2

I have a MySQL database where i want to clean up a table but i do not know how to compare against other table entrys and hope someone can help.

One table in the database is called "stats". in the table "Stats" there is a row called "Page_title" which holds an ID number. The same ID number should exist in the table "url,id" otherwise that entry from "stats" should be removed, how can this be done?

Please see this image for reference.

Michael
  • 1
  • 4

1 Answers1

0

You can do this with a sub select:

delete from stats where page_title not in (select id from shorturl)
Simon Martinelli
  • 34,053
  • 5
  • 48
  • 82