如何统计一条查询语句的记录数?
有这样一条语句:select deptboot from emp_user WHERE EmpID IN (294, 292) group by deptboot,它的结果有N条记录.我要想统计出这条语句查询出了多少条记录,请应该怎样写这样统计语句?
------解决方案--------------------有这样一条语句:select deptboot from emp_user WHERE EmpID IN (294, 292) group by deptboot,它的结果有N条记录.我要想统计出这条语句查询出了多少条记录,请应该怎样写这样统计语句?
以下两个不知道你需要的是哪个?
select deptboot , count(*) cnt from emp_user WHERE EmpID IN (294, 292) group by deptboot
select count(*) from
(
select deptboot from emp_user WHERE EmpID IN (294, 292)
) t