I have a database table where there is a column hostname and few other columns. in hostname, there are many instances of rows with same hostnames.
Ex. 192.0.0.1 has 40 entries and 192.0.0.2 has 35 entries and so on.
Is it possible to get the list of latest entries for each hostname? meaning in the result i should get one latest for 192.0.0.1 and one latest for 192.0.0.2 and so on.
I tried with
SELECT host,cluster,region,service
FROM system
WHERE host IN ("171.33.64.158","171.33.64.159")
ORDER BY id DESC LIMIT 1;
but the output contains only one row which is probably the first row of the entire result.
Can anyone please help me in this requirement?
Thanks, Swapnil