I currently have a table that contain a list of salary numbers and dates. Each salary number has more than one date. I need to get a table containg salary number, *date, and max date less than *date. So far have been unable to achieve this, Please Help.
SELECT a.field1, a.field2
FROM table a
WHERE *DATE = (SELECT MAX(*DATE)
FROM table b
WHERE b.primary_key = a.primary_key)
The substitute the field names that you want into the first select statement, and into the where clause of the subquery, change primary_key to whatever field is your unique reference (e.g. employee id etc.)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.