这样?
select lx,sum(cnt) from (select lx,count(lx) cnt from test where lx = '2' group by lxunion allselect 2,0) tgroup by lx