I have an table called DemoTable contains some fields like com_name, updated_date, demo_var, I queried on it like
select * from DemoTable where demo_var=100;
so for example here i got 1000 records. On this 1000 record i want to query to get the last updated row of com_name based on updated_date
My table looks like
id demo_var com_name updated_date
1 100 XYZ 2017-11-10
2 100 XYZ 2017-11-09
3 100 ABC 2017-10-10
4 100 ABC 2017-10-11
5 150 AJD 2017-11-11
First I want to fecth where demo_var=100 and get the different com_name which are last before updated ones.
For example like
2 100 XYZ 2017-11-09
3 100 ABC 2017-10-10
I want these two records to be fetched.