我尝试过使用以下查询但不起作用。
select Customer_id,Customer_Name from Customer
order by Customer_id limit 2
答案 0 :(得分:1)
试试这个:
SELECT TOP 2 Customer_id, Customer_Name FROM Customer
ORDER BY Customer_id DESC
ORDER BY Customer_id DESC
部分获取最后两个ID。
答案 1 :(得分:0)
在SQL Server上,正确的语法是
sorting
对于您的特定情况,它将是
SELECT TOP [number][%]...
答案 2 :(得分:0)
正如Prdp所说,使用top会解决它。
select top 2 Customer_id,Customer_Name from Customer
order by Customer_id