Access SQL query: find the row with the most recent date for each distinct entry in a table

后端 未结 5 1842
盖世英雄少女心
盖世英雄少女心 2021-02-06 08:50

All,

I\'m sure this is a pretty simple SQL query question, but I\'m sure there\'s a good way, and a very BAD way, to do this. Left to my own devices, I\'m liable to end

5条回答
  •  囚心锁ツ
    2021-02-06 09:03

    I think what you're looking for is this:

    select id, value, as_of from table_name where as_of = max(as_of) group by id

    This says for each id, find the max as_of, and get that value.

    This is generic sql. I'm not sure about access. I'm sure if this doesn't work there is something similar.

    Good luck! Joe

提交回复
热议问题