I am trying to join 2 tables and select the latest timestamp only and the field values associated with that latest timestamp
Data tables:
device_count
id  device_name     platform    version     timestamp
1   abc             123         x           2013-12-30
2   abc             123         y           2014-01-01
3   def             345         x           2013-12-30
device_list
id      device_name     Network     Division    Market
2657    def             a           f           d
2656    abc             a           b           c
The desired result should be
device_name     platform    version     network     division    market  timestamp
abc             123         y           a           b           c       2014-01-01
def             345         x           a           f           d       2013-12-30
I have used the following query but I'm not getting the correct results
SELECT
device_count.device_name,
device_count.platform,
device_count.version,
Max(device_count.`timestamp`),
device_list.Network,
device_list.Division,
device_list.Market
FROM
device_count
INNER JOIN device_list ON device_count.device_name = device_list.Device_Name
GROUP BY
device_count.device_name,
device_count.platform,
device_count.version,
device_list.Network,
device_list.Division,
device_list.Market
It results in
device_name     platform    version     network     division    market  timestamp
abc             123         x           a           b           c       2013-12-30
abc             123         y           a           b           c       2014-01-01
def             345         x           a           f           d       2013-12-30
The first record should not be included. I only want the version and platform values from the latest timestamp (record id 2)
 
     
     
    