2014-01-17から1日間の記事一覧

複数のCOUNT

条件の異なる複数のCOUNTを1クエリでやりたい select count(1), count(if(a=0,1,null)), count(if(b>0,1,null)) from test 【SQL】複数の条件のcountを1回の問い合わせでおこなう at softelメモ

HIVEでgroup by

selectするカラムをgroup byしないといけない select a,b,c from test group by a する場合 select a,b,c from test group by a,b,c みたいにする select a b count(c) from test group by a,b countやsum等はgroup byしなくてもOK LanguageManual GroupBy -…