hive:(group by, having;order by)的使用;group by+多個欄位,以及wiki說的group by兩種使用限制驗證
hive> select * from app_data_stats_historical where os='1' group by dt limit 100; 出現結果如下: 2014-01-01 2014-01-06 ...... 2014-02-07 2014-02-10 2014-02-14 2014-02-17 2014-02-24 (只返回了一列日期。說明* 不起作用。不過這樣,可以檢視總共哪些日期,有效,存在資料) 加上having命令,having只作用於group by中的欄位,非group的欄位不行: select * from app_data_stats_historical where os='1' group by dt having dt>' limit 1002014-02-01' limit 100; 2014-02-03 2014-02-04 2014-02-07 2014-02-10 2014-02-14 2014-02-17 2014-02-24 (可以用日期進行比較。) hive> select * from app_data_stats_historical where os='1' order by dt desc limit 100; 欄位是全部返回的。降序。