I have 4 tables each with a text primary key (name), and each of them is a different age. I have imported them all, oldest to newest, into another table. The new table has a numeric incremental key (ID), so the old entries have lower IDs. I want to produce a table of only the newest versions of each record. I have a query that does it:
The problem is that it runs the ^%$# sub-query every time, and takes a &^%$ day and a half to run the query. Anybody got some ideas? Thanks!
Code:
SELECT *
FROM Customers
WHERE ID IN (SELECT MAX(ID)
FROM Customers
GROUP BY name);