How to select latest change done in the given Table structure?
Posted
by OM The Eternity
on Stack Overflow
See other posts from Stack Overflow
or by OM The Eternity
Published on 2010-05-03T05:17:20Z
Indexed on
2010/05/03
5:28 UTC
Read the original article
Hit count: 237
I have a Table structure as id, trackid, table_name, operation, oldvalue, newvalue, field, changedonetime
Now if I have 3 rows for the same "trackid" same "field", then how can i select the latest out of the three?
i.e. for e.g.:
id = 100 trackid = 152 table_name = jos_menu operation= UPDATE oldvalue = IPL newvalue = IPLcccc field = name live = 0 changedonetime = 2010-04-30 17:54:39
and
id = 101 trackid = 152 table_name = jos_menu operation= UPDATE oldvalue = IPLcccc newvalue = IPL2222 field = name live = 0 changedonetime = 2010-04-30 18:54:39
As u can see above the secind entry is the latest change, Now what query I shoud use to get the only one and Latest row out of many such rows...
© Stack Overflow or respective owner