SQLite Forum

How to convert to CTE
Login
Thanks for that. It runs and it is surprisingly fast, but the results are wrong. Very complex query, but noticed you use:
MAX(A.DATE_STATUS_ADDED)
and not sure that can work as there are duplicate dates for the same ID.
I think you may need better (more) sample data to test. Can I post a .csv file as an attachment?

RBS