>I have a situation where a record represents a piece of art being created. It can go through various phases (request, initial completion, client approval, etc.) and may repeat some. So there is a child table that holds the task/phase, when it was assigned, and who assigned it. There is an index on the date/time field set up as descending so that the latest task/phase is always at the top. I need to select records whose current task/phase is a certain task/phase. It's easy enough to select records with this task/phase, but is there syntax that will let me select records where a particular task/phase is the most recent task/phase for that record? I can do this with a SQL statement and some iterative programming, but I was wondering about getting it done in one SQL statement.
Hi Russell,
Try (not tested)
SELECT *
FROM mytable mt1
WHERE task = lcTask
AND NOT EXISTS ( SELECT * FROM mytable
WHERE ArtID = mt1.ArtID
AND date > mt1.date)
--sb--