我知道这是一个简单的问题,但我不能让它工作。
这是我在SqlCommand中的查询
SELECT * FROM zipcode WHERE city LIKE @prefixtext + '%' ;我只想要10个结果,其他答案都是这样的
SELECT TOP 10 * FROM zipcode WHERE city LIKE @prefixtext + '%' ;
SELECT * FROM zipcode WHERE city LIKE @prefixtext + '%' LIMIT 10 ;两者都不起作用
发布于 2012-06-07 12:49:32
我相信这些都是正确的。
Oracle:
select * from zipcode where city like @prefixtext + '%' and rownum <=10SQL Server/Sybase:
select top 10 * from zipcode where city like @prefixtext + '%'DB2/PostgreSQL:
select * from zipcode where city like @prefixtext || '%' fetch first 10 rows onlyMySQL:
select * from zipcode where city like @prefixtext + '%' limit 10发布于 2012-06-07 12:41:14
declare @like varchar(50)
set @like = @prefixtext + '%';
SELECT TOP 10 * FROM zipcode WHERE city LIKE @like发布于 2012-09-11 17:57:21
Select * from zipcode where city like @prefixtext + '%'https://stackoverflow.com/questions/10925050
复制相似问题