你说的不清楚.
如果有3条记录, 2个记录的nStatus=1, 1个记录的nStatus=0, 你想得到什么样的结果???

解决方案 »

  1.   

    对不起,我未阐述清楚!!!(即统计锁使用情况:使用的锁牌数和未使用的锁牌数)
    当然是如下一条记录:    2   1如下SQL不行:
     Select Count(*) From TB_Locks Where nStatus=0 --统计已用
     Union
     Select Count(*) From TB_Locks Where nStatus=1 --统计未用
      

  2.   

    select count1,count2 from
    (select count(*) count1 from TB_Locks where nStatus=0 ) aa, 
    (select count(*) count2 from TB_Locks where nStatus=0 ) bb
      

  3.   

    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