I have MySQL 4.0 (so no subqueries please) and I have one table with distinct phone numbers, and one table with six-months of call records. I want to count the occurences of each number in table A using the call records in table B. But, in the same query I want to UPDATE the phone number row in table A with that count.
If I use PHP, I just ran one query to count the phone number occurences in table B and another query to update table A. The problem is that it takes forever because table B has 973,000 rows of data.
Any ideas? Should I just upgrade to Mysql 4.1 and use a subquery to do that?