select count(*) from table where STATUS==0 union all select count(*) from table where STATUS!=0
修正:STATUS BOOLEAN -->BOOLCREATE OR REPLACE TABLE ( RECORDID INT NOT NULL AUTO_INCREMENT PRIMARY KEY , STATUS BOOL DEFAULT 0 );
set @isZero; set @isnotZero; select @isZero:=count(*) from table where STATUS=0; select @isnotZero:=count(*) from table where STATUS<>0; select @isZero,@isnotZero;
set @isZero; set @isnotZero; select @isZero:=count(*) from table where STATUS=0; select @isnotZero:=count(*) from table where STATUS<>0; select @isZero,@isnotZero;同意!
union all
select count(*) from table where STATUS!=0
(
RECORDID INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
STATUS BOOL DEFAULT 0
);
set @isnotZero;
select @isZero:=count(*) from table where STATUS=0;
select @isnotZero:=count(*) from table where STATUS<>0;
select @isZero,@isnotZero;
set @isnotZero;
select @isZero:=count(*) from table where STATUS=0;
select @isnotZero:=count(*) from table where STATUS<>0;
select @isZero,@isnotZero;同意!