我们如何在sql查询中使用like和limit一起使用?

时间:2022-03-03 16:39:50
SELECT * FROM Customers
WHERE City LIKE 'b%' limit 3;

gives the following error:

给出以下错误:

Syntax error (missing operator) in query expression 'City LIKE 'b%' limit 3'.

1 个解决方案

#1


3  

Error message indicates that you are using MS Access. You need to use TOP instead of LIMIT:

错误消息表明您正在使用MS Access。您需要使用TOP而不是LIMIT:

SELECT TOP 3 * FROM Customers
WHERE City LIKE 'b%'
-- ORDER BY some_column'; -- to get stable results

#1


3  

Error message indicates that you are using MS Access. You need to use TOP instead of LIMIT:

错误消息表明您正在使用MS Access。您需要使用TOP而不是LIMIT:

SELECT TOP 3 * FROM Customers
WHERE City LIKE 'b%'
-- ORDER BY some_column'; -- to get stable results