SQL 多条件查询多结果

            var query = 'SELECT COUNT(*) as count_all , ' +
            		'SUM(Case when checkResult = 1 then 1 else 0 end ) as count_no, ' +
            		'SUM(Case when checkResult = 2 then 1 else 0 end ) as count_even, ' +
            		'SUM(Case when checkResult = 3 then 1 else 0 end ) as count_earn, ' +
            		'SUM(Case when checkResult = 4 then 1 else 0 end ) as count_lose, ' +
            		'checkTypeView as checkTypeView, '+
            		'checkNumber as checkNumber, '+
            		'FROM CheckList' +
            		' group by cellType'; 
这样查询结果将返回一个object对象,包含总数count_all,checkResult各不同的总数count_no,count_even,count_earn,count_lose,已经'checkTypeView 、'checkNumber 对象


你可能感兴趣的:(SQL 多条件查询多结果)