我将通过这个查询来计算返回的行数:
select * from tableName where( number > 1000);我尝试了这个查询以获得行数:
select count(*) as count from (select * from tableName where( number > 1000));但我有语法错误。这有什么问题吗?
发布于 2014-08-25 05:00:47
如果您使用的是嵌套查询&不要使用“count”作为临时变量名,这是可行的:
select count(temp.id) as num from (select * from tableName where number > 1000) temp发布于 2014-08-25 04:59:16
您不想要嵌套查询,只需使用
select count(*) as count from tableName where number > 1000 ;发布于 2014-08-25 04:56:20
应该是这样的
select count(*) as noOfCount from tableName where number > 1000;不要使用sql保留关键字作为临时变量名。
https://stackoverflow.com/questions/25479229
复制相似问题