我想根据行号查询mysql?假设我想查询最后 10 行,如何在 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`