Hi Friends,
I am getting the below error while executing the query.
""The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.""
my query says before adding delivery how much stock in FG warehouse and after delivery how much stock in fg warehouse...
select t0.docnum,t0.cardname,t0.NumAtCard,t0.Comments,
convert(varchar,t0.docduedate,103) as Date,t1.itemcode,t1.dscription,t2.WhsCode,t2.OnHand as After_DELIVERY_STOCKQTY,
t1.Price,t1.linetotal,t1.vatsum,t1.baseref,t1.quantity,(select sum(t5.inqty)-sum(t5.outqty)) as BEFORE_DELIVERY_STOCKQTY,
(SELECT distinct TOP 1 Street FROM CRD1 WHERE CardCode=T0.CardCode AND AdresType='B') AS STREET,
(SELECT distinct TOP 1 BLOCK FROM CRD1 WHERE CardCode=T0.CardCode AND AdresType='B') AS BLOCK,
(SELECT distinct TOP 1 CITY FROM CRD1 WHERE CardCode=T0.CardCode AND AdresType='B') AS CITY,
(SELECT distinct TOP 1 State FROM CRD1 WHERE CardCode=T0.CardCode AND AdresType='B') AS STATE,
(SELECT distinct TOP 1 ZipCode FROM CRD1 WHERE CardCode=T0.CardCode AND AdresType='B') AS ZIPCODE,
T3.SeriesName AS SERIES,T4.LineText AS LINETEXT
from ODLN t0 inner join DLN1 t1 on t0.DocEntry=t1.DocEntry
left outer join OITW t2 on t1.ItemCode=t2.ItemCode
LEFT OUTER JOIN NNM1 T3 ON T0.Series=T3.Series
LEFT OUTER JOIN DLN10 T4 ON T0.DocEntry=T4.DocEntry AND T1.LineNum=T4.LineSeq
left join OINM t5 on t1.ItemCode=t5.ItemCode
where t2.WhsCode='fg'
group by t0.docnum,t0.cardname,t0.NumAtCard,t0.Comments,t0.docduedate,t1.itemcode,t1.dscription,t2.WhsCode,t2.OnHand,t1.Price,
t1.linetotal,t1.vatsum,t1.baseref,t1.quantity,T0.CardCode,T4.LineText,T3.SeriesName
Regards
Vinoth