对不起,我未阐述清楚!!!(即统计锁使用情况:使用的锁牌数和未使用的锁牌数) 当然是如下一条记录: 2 1如下SQL不行: Select Count(*) From TB_Locks Where nStatus=0 --统计已用 Union Select Count(*) From TB_Locks Where nStatus=1 --统计未用
select count1,count2 from (select count(*) count1 from TB_Locks where nStatus=0 ) aa, (select count(*) count2 from TB_Locks where nStatus=0 ) bb
sorry. 敲錯了. 是: select count1,count2 from (select count(*) count1 from TB_Locks where nStatus=0 ) aa, (select count(*) count2 from TB_Locks where nStatus=1 ) bb
当然是如下一条记录: 2 1如下SQL不行:
Select Count(*) From TB_Locks Where nStatus=0 --统计已用
Union
Select Count(*) From TB_Locks Where nStatus=1 --统计未用
(select count(*) count1 from TB_Locks where nStatus=0 ) aa,
(select count(*) count2 from TB_Locks where nStatus=0 ) bb
敲錯了.
是:
select count1,count2 from
(select count(*) count1 from TB_Locks where nStatus=0 ) aa,
(select count(*) count2 from TB_Locks where nStatus=1 ) bb