I have a problem. I have 3 tables like below:
1) met_ID (primair) etc.
2) magn_ID (primair)
met_ID (secondary)
…
3) sens_ID (primair)
met_ID (secondary)
…
I have to delete records in table 1 where met_ID count in table 2 OR 3 is less than 10..
SELECT COUNT(*) AS count, met_ID
FROM tbl_1, tbl_2
Where met_ID = met_ID
GROUP BY met_ID
I made a query and in PHP with WHILE loop i am deleting that records from table 1. It works fine for 1000 records to delete, but I am not sure if it will be use full for 100 000 or more records in table.
Is there any way to accomplish what i do in sql query?
1 Answer