Can someone advise on the MySQL query for the following scenario:
I have a table full of files availble for download (tblFiles), I also have a junction table (jtbl_Downloads) that contains a users id (UserId) and files id (FileId). Each time a user downloads a file, it adds an entry to jtbl_Downloads. The problem is that I cleaned out tblFiles table, deleting many files. Now I have all of these download entries refering to files that no longer exist.
How can I construct a query that says,
DELETE FROM jtbl_Downloads WHERE FileId does not exist in tblFiles
Thanks!