Skip to Content
0
Former Member
Apr 10, 2013 at 09:49 AM

Query for Customer outstanding balance with Address

661 Views

Hi Experts,

I executing the below query and i am getting below error. how to fix this?

SELECT T1.[ShortName], T2.[CardName], T1.[Account], sum(T1.[Debit]) as 'Debit', sum(T1.[Credit]) as 'Credit', sum(T1.[Debit])- sum(T1.[Credit]) as 'Balance', T3.[Address], T3.[Street], T3.[Block], T3.[StreetNo], T3.[Building], T3.[City], T3.[State],T3.[Country], T3.[ZipCode] FROM dbo.OJDT T0

INNER JOIN dbo.JDT1 T1 ON T0.TransId = T1.TransId INNER JOIN dbo.OCRD T2 on T2.CardCode = T1.[ShortName] INNER JOIN CRD1 T3 ON T2.CardCode = T3.CardCode WHERE T2.[CardType] ='c' and

T2.[Balance] !=0 and

T3.[AdresType] ='b' GROUP BY T1.[ShortName], T2.[CardName], T1.[Account],T3.[Address], T3.[Street], T3.[Block], T3.[StreetNo], T3.[Building], T3.[City], T3.[State],T3.[Country], T3.[ZipCode]

Error

1). [Microsoft][SQL Server Native Client 10.0][SQL Server]The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. 2). [Microsoft][SQL Server Native Client 10.0][SQL Server]Statement 'Service Contracts' (OCTR) (s) could not be prepared.

Regards,

Dwarak