mysql order by .. limit.. 筆記

當數據庫中數據都爲0的時候 使用order by  limit start limt sql語句時候  注意mysql

 order by   limit 0,10 與 order by limit 10,10會出現重複數據,新版的mysql會有這個問題sql

the differences in that between MariaDB 5.5.50 and 10.1 數據庫

加上 id就能夠避免這個問題code

You do not specify which ten first rows you want to obtain. As there are a lot of rows for which published equals 0 MariaDB is free to choose some of them. If you want a specific order try:ci

SELECT advert_id, published, id FROM vacancies ORDER BY published asc, id LIMIT 10;
相關文章
相關標籤/搜索