我想根據行號查詢mysql嗎?假設我想查詢最後10行,如何在mysql查詢中做到這一點?如何計算mysql查詢中的行數?
這裏是我的MySQL查詢,但根據6天的間隔查詢,但我需要根據最後10行的代6-天的間隔進行查詢,
SELECT people_id, people_number 'people number', count(people_number) 'Occurs',
(
Select count(people_number) from people_history
where people_id = 5486 and date > DATE_SUB(NOW(), INTERVAL 6 DAY)
) 'Total',
count(people_number)/(
Select count(people_number) from people_history
where people_id = 5486 and date > DATE_SUB(NOW(), INTERVAL 6 DAY)
)*100 'Percent'
FROM people_history
where people_id = 5486 and date > DATE_SUB(NOW(), INTERVAL 6 DAY)
group by people_id, people_number
order by Percent desc`
小心地擴大一點? –
10行什麼'LIMIT'我需要使用 – Jeniffer