Reputation: 1151
I have many simple query to run in MySQL Workbench:
SELECT deviceID
, from_unixtime(timestamp)
FROM EventData
where accountID = '001'
and deviceID = 'FFF'
order
by timestamp desc
limit 1;
I'm doing this to get the max timestamp
value of every deviceID
in a really huge active table that's why I make many queries to get faster results.
I tried with "deviceID IN(...)
" but it takes too long and I don't want to hung up the server.
Upvotes: 0
Views: 34
Reputation: 74605
Why aren't you using built in functions for summarising data?
SELECT
deviceID,
from_unixtime(MAX(timestamp)) as timestamp
FROM
EventData
where
accountID='001'
GROUP BY
deviceID
Upvotes: 1