i have a table in MySQL that is updated about every 5 minutes with about a hundred new records. For an application i am building, i only need the info from the most recent entry for each specific unit. But, i need all of the info in that row.
i was going to use DISTINCT like this,
SELECT DISTINCT UnitNumber FROM table ORDER BY `autoinc` DESC
it gives me only the last record for each unit, but only returns the UnitNumber and i need all of the colums for each UnitNumber that it gives me.
or if i use something like this, will it only pull out items that have only one entry of each?
select distinct UnitNumber, value1, value2 from table order by autoinc desc
or is there a better way?