Can anyone help me with this ?
I would like to compare the date with the SAME ID and extract the row based on LV_DATE - the latest date .
Is it possible to do so ?
I tried to do it in query but I couldn't get the result that I want : Below is the code
Code:
SELECT a.GROUP_NO , iif( a.LV_DATE < b.LV_DATE , b.LV_DATE , a.LV_DATE ) AS LVDate , b.LV_INS
FROM test4 AS A
INNER JOIN test4 AS B
ON (A.LV_INS < B.LV_INS) AND (a.GROUP_NO = b.GROUP_NO)
WHERE ((A.LV_INS) <> (B.LV_INS)) ;
Kindly help Thanks in advance
This is the result that I want based on the table below
GROUP_NO |
LVDATE |
LV_INS |
1 |
01/01/2016 |
ABC |
2 |
02/02/2016 |
RED |
3 |
02/02/2016 |
JIN |
|
|
|
Here is the sample of my table
GROUP_NO |
LVDATE |
LV_INS |
1 |
01/01/2015 |
ABC |
1 |
01/01/2016 |
ABC |
2 |
02/02/2016 |
RED |
2 |
|
|
3 |
02/02/2016 |
JIN |
3 |
02/02/2016 |
JIN |
|
|
|