sql的一些执行顺序
1、
select date_trunc('month',inserttime),count(1) from tablea group by inserttime;
先按inserttime分组后,再去格式化inserttime
select date_trunc('month',inserttime),count(1) from tablea group by date_trunc('month',inserttime);
按格式化之后的inserttime分组,再去格式化inserttime
2、
where在group by之前

浙公网安备 33010602011771号