Saturday, 15 August 2015

php - MySQL Query line, 3 highest values? -



php - MySQL Query line, 3 highest values? -

i creating blog , have decided order blog id, because want display 3 on homepage , of them in blog. anyhow thats not problem straight point need help mysql query.

say illustration have next id's in database: 1 2 3 4 5 6 7 8 9 10.

i want show 3, newest 3 8, 9 10. dont know how i'd query please inquire query line mysql please?

i know stupid question have found illustration of mean talking adding 2 numbers together? need 1 number placed in order.

anyhow, guys!

you can sort id, descending. place post highest id @ start of result set. can utilize limit homecoming 3 results (i.e. latest 3).

select `post_id` `tblname` order `post_id` desc limit 3

php mysql

No comments:

Post a Comment