简体   繁体   中英

Start querying on a certain row criteria

I have a mysql table which columns are post_id and post_msg. Now I want to query starting from a row that has a value of 3 in its post_id column. As a result of this query all the rows starting from post_id 3 (ASC) will be the result set. How can i do this?

 post_id | post_msg   
   1     |   heheh   
   2     |   hi   
   3     |   hello 
   4     |   hoho  
   5     |   hayhay   
   6     |   harhar

from that table i want to query starting to a row that has a post_id that its value is 3 I know to use LIMIT but my requirement is really to use the post_id for some reasons. Is this possible?

you can try /// please correct me if I am wrong

select post_id , post_msg from 
table1 where post_id > = '@post_id_val'
group by post_id ,post_msg
order by post_id

What I am getting with question is that you want to show rows having post_id more then or equal to @post_id_val.. with ascending order of post_id..

请尝试以下方法:

SELECT post_id,post_msg FROM table WHERE post_id >= 3 ORDER BY post_id

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM