-
Notifications
You must be signed in to change notification settings - Fork 651
Description
version: 1.0.0-rc.3
SQL:SELECT * FROM ( with bqljzsr as ( SELECT COALESCE(sum(aml.credit),0) as amount FROM account_move am, account_move_line aml, account_account aa, dy_fin_account_period ap, dy_fin_account_period ap1, account_fiscal_year ay where 1=1 and am.id=aml.move_id and aml.account_id=aa.id and aml.period_id=ap.id and aa.account_attribute='income' and ap1.fiscal_year_id=ay.id and ap1.fiscal_year_id=ap.fiscal_year_id and ap.date_from<=ap1.date_from and ap1.id=$PERIOD_ID$), sqljzsr as ( SELECT COALESCE(sum(aml.credit),0) as amount FROM account_move am, account_move_line aml, account_account aa, dy_fin_account_period ap1, account_fiscal_year ay1, account_fiscal_year ay, dy_fin_account_period ap where 1=1 and am.id=aml.move_id and aml.account_id=aa.id and aml.period_id=ap.id and aa.account_attribute='income' and ap1.fiscal_year_id=ay1.id and ap.fiscal_year_id=ay.id and ap1.id=$PERIOD_ID$ and ay.date_from=ay1.date_from- INTERVAL '1 year' and ap.date_from<=ap1.date_from- INTERVAL '1 year'), bqzsr as ( SELECT COALESCE(sum(aml.credit),0) as amount FROM account_move am, account_move_line aml, account_account aa, dy_fin_account_period ap where 1=1 and am.id=aml.move_id and aml.account_id=aa.id and aml.period_id=ap.id and aa.account_attribute='income' and ap.id=$PERIOD_ID$ ), sqzsr as ( SELECT COALESCE(sum(aml.credit),0) as amount FROM account_move am, account_move_line aml, account_account aa, dy_fin_account_period ap1, dy_fin_account_period ap where 1=1 and am.id=aml.move_id and aml.account_id=aa.id and aml.period_id=ap.id and aa.account_attribute='income' and ap.date_from=ap1.date_from- INTERVAL '1 month' and ap1.id=$PERIOD_ID$ ) select round(((bqljzsr.amount-sqljzsr.amount)/sqljzsr.amount)*100,2) as rate,'总收入同比' as type from bqljzsr,sqljzsr union all select round(((bqzsr.amount-sqzsr.amount)/sqzsr.amount)*100,2) as rate,'总收入环比' as type from bqzsr,sqzsr ) AS "DATART_VTABLE" OFFSET 0 ROWS FETCH NEXT 1000 ROWS ONLY
DB: POSTGRESQL
EXCEPTION:org.apache.calcite.sql.parser.SqlParseException: Encountered "and" at line 1, column 988.
Was expecting one of:
"DAY" ...
"DAYS" ...
"HOUR" ...
"HOURS" ...
"MINUTE" ...
"MINUTES" ...
"MONTH" ...
"MONTHS" ...
"SECOND" ...
"SECONDS" ...
"YEAR" ...
"YEARS" ...