Select two MAX record per each
Hi!
I would be very happy if anybody could help me in the following.
table contains the following fields,
ConsultantID
ConsultantType
StartDate
ExpDate
UpdatedDate
UpdatedBy
UpdatedInfo
The tables allows same IDs(more than One) with diff. data with new UpdatedDate
I need a query to display .. MAX Two Reords based on Updated date for all IDs. this is my basic one.
and after getting the two records for each consultantID,
I need to display the secondMax record only if the defference between
the secondMax record (ExpDate) and FirstMAx record (Startdate) is less than 25.
Im working on this qurey from last 3 days ...
Plz.. help me to get the solution...
Thanks & Regards,
Veeru.
|