【发布时间】:2017-08-31 22:27:27
【问题描述】:
select
c_elementvalue.value AS "VALUE",
c_elementvalue.name AS "NAME",
rv_fact_acct.postingtype AS "POSTINGTYPE",
sum(rv_fact_acct.amtacct) AS "AMNT",
'YTDB' AS "TYPE",
c_period.enddate AS "ENDDATE",
max(ad_client.description) AS "COMPANY"
from
adempiere.c_period,
adempiere.rv_fact_acct,
adempiere.c_elementvalue,
adempiere.ad_client
where
(rv_fact_acct.ad_client_id = ad_client.ad_client_id ) and
(rv_fact_acct.c_period_id = c_period.c_period_id) and
(rv_fact_acct.account_id = c_elementvalue.c_elementvalue_id) and
(rv_fact_acct.dateacct BETWEEN to_date( to_char( '2017-03-01' ,'YYYY') ||'-04-01', 'yyyy-mm-dd') AND '2017-03-31' ) AND
(rv_fact_acct.ad_client_id = 1000000) and
(rv_fact_acct.c_acctschema_id = 1000000 )and
(rv_fact_acct.postingtype = 'B')and
(rv_fact_acct.accounttype in ('R','E') )
group by c_elementvalue.value , c_elementvalue.name , rv_fact_acct.postingtype , c_period.enddate
order by 5 asc, 1 asc
执行上述 sql 语句(postgres)时收到错误消息。
错误信息:
[Err] ERROR: function to_char(unknown, unknown) is not unique
LINE 68: (rv_fact_acct.dateacct BETWEEN to_date( to_char( '2017-03-...
^
HINT: Could not choose a best candidate function. You might need to add explicit type casts.
【问题讨论】:
-
你想用什么逻辑来过滤账户日期?你现在的代码没有意义。
标签: postgresql