[英]find first and last row of database table mysql in a single select without using UNION
[英]select last n row from a table in mysql without using order by
select * from employee limit select count(*)-1 from employee,1;
ERROR 1064 (42000):您的 SQL 語法有錯誤; 檢查與您的 MySQL 服務器版本相對應的手冊,了解在第 1 行的“select count(*)-1 from employee,1”附近使用的正確語法
希望這項工作
select * from your_table except
select top ((select count(*) from your_table) - how many rows you want)* from your_table
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.