php - Select data from the most recent row, with a particular ID -
i have database looks this:
id | account_id | date_time | followers -------------------------------------------------------------- 1 | 1813 | 2014-11-16 09:31:52 | 1527 -------------------------------------------------------------- 2 | 1826 | 2014-11-16 09:31:52 | 900 -------------------------------------------------------------- 3 | 1854 | 2014-11-16 09:32:25 | 15342 -------------------------------------------------------------- 4 | 1813 | 2014-11-16 16:31:52 | 1539 -------------------------------------------------------------- 5 | 1826 | 2014-11-16 16:31:52 | 905 -------------------------------------------------------------- 6 | 1854 | 2014-11-16 15:32:25 | 15349 --------------------------------------------------------------
the database repeats same sort of entries twice-daily. each day there 2 new entries account_id
1813, 1826, 1854 etc.
how can select number of followers
last entry particular account_id
?
so using data above, include account_id 1813
, follower_count
1539.
i'm using php , mysqli if helps.
select followers your_table account_id = 1813 order date_time desc limit 1
Comments
Post a Comment