select count(name1),count(name2) from your_table; 通过这样计算,不会计算你字段为null的
我想要这样的select name1,count(name1),name2,count(name2) from test.....
select name1,total1,name2,total2 from ( select name1,count(name1) total1 from test group by name1 ) , (select name2,count(name2) total2 from test group by name2 );
select name1,total1,name2,total2 from ( select name1,count( distinct name1) total1 from test group by name1 ) , (select name2,count( distinct name2) total2 from test group by name2 );
select name1,count(name1)over(partition by name1 ),name2,count(name2)over(partition by name2) from test.....
通过这样计算,不会计算你字段为null的
我想要这样的select name1,count(name1),name2,count(name2) from test.....
(
select name1,count(name1) total1 from test group by name1
)
,
(select name2,count(name2) total2 from test group by name2
);
select name1,total1,name2,total2 from
(
select name1,count( distinct name1) total1 from test group by name1
)
,
(select name2,count( distinct name2) total2 from test group by name2
);