Skip to content Skip to sidebar Skip to footer

Find Max Value And Show Corresponding Value From Different Field In Ms Access

So I found this similar question and answer at (Find max value and show corresponding value from different field in SQL server) but I want to take it one step further. I want to g

Solution 1:

You can use the first method with a correlated subquery:

select id, type, datefrom yourtable as t
wheredatein (select max(date)
               from yourtable as t2
               where t2.id = t.id);

Or, group by id in the second:

select t1.id, t1.type, t1.datefrom yourtable as t1 inner join
     (select id, max(date) maxdate
      from yourtable
      groupby id
     ) t2
     on t1.date = t2.maxdate and t1.id = t2.id;

Post a Comment for "Find Max Value And Show Corresponding Value From Different Field In Ms Access"