例子:
SELECT
MAX (A .a) as a,
MAX (A .ob) as b,
A .c
FROM
t_table A
WHERE
A .created_date <= '2019-08-14 23:59:59' AND a.cust_name is NOT NULL
GROUP BY
A .c
根据字段c来分组,但是若需要显示其他字段,那么必须添加max 或 min 函数,否则会出现如下错误:
[Err] ERROR: column "列名" must appear in the GROUP BY clause or be used in an aggregate function
这是与mysql 不同之处
参考连接:
https://874395012.iteye.com/blog/2379591