简体   繁体   中英

How can I get ID from MYSQL

I want to get ID value from mySQL table. For example :Get id from Second row or Third row. How can I do this?

SELECT Id From myTable --------- ; 

What is the second row syntax?

If you want to fetch second row then use LIMIT 2, 1 and if you want 3rd row then use LIMIT 3, 1 .

Try this:

SELECT Id 
FROM myTable
ORDER BY Id 
LIMIT 2, 1;

2 ways to do that...

Return 1 record, start from second record

 select id from table_name limit 2,1

Fetch 10 records, leave first 15.

 SELECT * FROM Orders LIMIT 10 OFFSET 15

查询后写限制1,1。

SELECT Id From myTable LIMIT 1,1; 

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