如何获取此查询的计数 - 从CountRecord中选择Count(*)(从Account中选择AccountId,*)

时间:2013-09-25 06:41:54

标签: sql

如何获取此查询的计数?

select AccountId, * from Account

2 个答案:

答案 0 :(得分:4)

Select Count(*) as CountRecord from Account

答案 1 :(得分:1)

您已将别名放在错误的地方

SELECT COUNT(*) AS CountRecord FROM (SELECT AccountId, * FROM Account) a
-----------------^^^^^^^^^^^^^^^

但你应该直接计算这样的记录:

SELECT COUNT(*) AS CountRecord FROM Account