時間:2024-02-05 12:47作者:下載吧人氣:25
最近,一個統計程序從Oracle移植到PostgreSQL(版本9.4)時,接連報告錯誤:
錯誤信息1: postgresql group by position 0 is not in select list.
錯誤信息2: non-integer constant in GROUP BY.
產生錯誤的sql類似于:
insert into sum_tab (IntField1, IntField2, StrField1, StrField2, cnt)
select IntField, 0, StrField, ‘null’, count(*) from detail_tab
where …
group by IntField, 0, StrField, ‘null’;
網友評論