如何使用一条sql语句统计行数
本来我是这么写的,自己感觉也不满意
declare @rowCount int,@rowCount1 int ,@rowCount2 int
set @rowCount=0
select @rowCount1=count(*) from elecpolicy where epprodsn = ''
select @rowCount2=count(*) from SonyPolicyRecommend where epprodsn = ''
set @rowCount=@rowCount1+@rowCount2
select @rowCount
能不能有一种办法 , 一条sql查询出结果?
[解决办法]
select (select count(*) from elecpolicy where epprodsn = '')+(select count(*) from SonyPolicyRecommend where epprodsn = '')