SQL STATEMENT WORKS WITH ADS BUT NOT PG
Posted: Sun Mar 16, 2025 7:28 pm
Hi All,
I have this statement that has worked well with ADS but failed in PG because PG has no month function:
SELECT Month(GLBook.DocDate) AS COL01, SUM(case when pc = 'D' then amount else 0 end) AS COL02, SUM(case when pc = 'C' then amount else 0 end) AS COL03, 0 AS COL04, 0 AS COL05, '' AS AcctPeriod, '' AS Site, '' AS Account FROM GLBook WHERE GLBook.DocDate >= ? AND GLBook.DocDate <= ? AND Account = ? AND Site = ? AND OrgCode = ? GROUP BY Month(GLBook.DocDate)
Your help will be highly appreciated
Thanks
Joe
I have this statement that has worked well with ADS but failed in PG because PG has no month function:
SELECT Month(GLBook.DocDate) AS COL01, SUM(case when pc = 'D' then amount else 0 end) AS COL02, SUM(case when pc = 'C' then amount else 0 end) AS COL03, 0 AS COL04, 0 AS COL05, '' AS AcctPeriod, '' AS Site, '' AS Account FROM GLBook WHERE GLBook.DocDate >= ? AND GLBook.DocDate <= ? AND Account = ? AND Site = ? AND OrgCode = ? GROUP BY Month(GLBook.DocDate)
Your help will be highly appreciated
Thanks
Joe