+ 2

SQL: Order and Limit

I have a Database with 10 Employees. Starting from 1 to 10. When I use this code: SELECT EmployeeID FROM Employees ORDER BY EmployeeID LIMIT 0,3; I get IDs 1,2,3 But when I add DESC after ORDER BY I get 10,9,8 is there any way I can get it to display 3,2,1?

19th Jun 2017, 8:59 PM
Limitless
Limitless - avatar
3 odpowiedzi
+ 2
SELECT EmployeeID FROM Employees WHERE EmployeeID < 4 ORDER BY EmployeeID DESC;
20th Jun 2017, 5:00 AM
Bàng Tứ Cường
Bàng Tứ Cường - avatar
+ 6
WHERE EmployeeID <= 3
19th Jun 2017, 9:24 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
Thanks. The other answer I have is: SELECT EmployeeID FROM ( SELECT EmployeeID FROM Employees ORDER BY EmployeeID LIMIT 0,3 ) ORDER BY EmployeeID DESC;
20th Jun 2017, 8:00 AM
Limitless
Limitless - avatar