I want to select Info by timestamp and UnitID. Heres the two tables:
Table Info:
ID | UnitID | Time | Info
-----------------------------------------------
1 | 101 | 2011-07-20 08:22:02 | info 101
2 | 102 | 2011-07-21 08:22:02 | info 102
3 | 103 | 2011-07-22 08:22:02 | info 103
4 | 104 | 2011-07-23 08:22:02 | info 104
5 | 104 | 2011-07-25 08:22:02 | info 104
6 | 102 | 2011-07-26 08:22:02 | info 102
The results I want is one for each UnitID and latest Time (timestamp) for this UnitID as:
ID | UnitID | Time | Info
------------------------------------------------
1 | 101 | 2011-07-20 08:22:02 | info 101
3 | 103 | 2011-07-22 08:22:02 | info 103
5 | 104 | 2011-07-25 08:22:02 | info 104
6 | 102 | 2011-07-26 08:22:02 | info 102
How do I make this Query?
1 Answer