类型不一致的7481-SQL何时和分组依据

时间:2019-03-06 13:28:15

标签: sql excel group-by case-when

想知道是否有人可以帮助我。我最近有这个查询,在某些情况下刚刚添加了一些措施来减少Excel中的处理。该数据库是ODBC。现在,当我尝试返回数据时,出现不一致类型7481的错误。任何人都可以帮助我。抱歉,我才刚刚真正开始使用SQL,所以对我来说很多是新的。

    SELECT 

Company_0.CoaCompanyName
, SUM(InvoiceCreditItem_0.IciInvoiceApproved) AS 'Approved' 
, SUM(CASE WHEN InvoiceCreditItem_0.InvoiceCreditID IS NULL THEN 1 END) AS 'Prepared'
, SUM(CASE WHEN InvoiceCreditItem_0.InvoiceCreditID IS NOT NULL THEN 1 END) AS 'Pending'
, InvoiceCreditItem_0.CompanySiteID
, InvoiceCreditItem_0.IciCreatedDate
, Sum(InvoiceCreditItem_0.IciTotalNettValue) As 'Total Nett Value'
, Sum(InvoiceCreditItem_0.IciVatValue) AS 'VAT Value'

FROM

SBS.PUB.Company Company_0
, SBS.PUB.InvoiceCreditItem InvoiceCreditItem_0

WHERE

InvoiceCreditItem_0.CompanyID = Company_0.CompanyID
AND (Company_0.CoaCompanyName<>'ATOS')
AND InvoiceCreditItem_0.IciCreatedDate >= ?


GROUP BY Company_0.CoaCompanyName, InvoiceCreditItem_0.CompanySiteID , InvoiceCreditItem_0.IciCreatedDate

0 个答案:

没有答案