hive -e "select count(id), friendcount from default.user where id > 0 and birthday != '\\N' group by friendcount" > friendcount.txt hive -e "select * from default.user where id > 0 and birthday != '\\N' group by friendcount limit 10000" > user.txt
数据显示 \N 的值,需要用 = '\\N' 去查询,非的时候就用 != '\N'
INSERT OVERWRITE LOCAL DIRECTORY '/tmp/result.txt' select id,name from t_test;
Group by 问题:Expression Not In Group By Key http://blog.csdn.net/wenlong237/article/details/10227419
select a.collegename, a.allcount from (select collegename, count(id) as allcount from default.user where collegename != '\N' group by collegename) a sort by a.allcount DESC
betweeen and 与 >= ,决不能等同于 in
select count(1) from default.user where univname REGEXP '上海' and univyear between 2011 and 2013; select count(1) from default.user where univname REGEXP '上海' and univyear >= 2011 and univyear <= 2013;
不同于下面
select count(1) from default.user where univname REGEXP '上海' and univyear in (2010, 2013);