Skip to Content
0
Jan 27, 2016 at 06:51 AM

add ordr in query

15 Views

SELECT

t1.DocNum,t0.clgcode,t1.docstatus, T0.Recontact, T1.CardName, T1.DocTotal, T0.CntctType,

T0.Notes,T0.CntctTime, T1.DocDate,T1.series,T4.SLPNAME

from

(Select docnum,clgcode,Recontact, CntctType,Notes,CntctTime

from dbo.OCLG

where ClgCode in(Select Max(clgcode) from dbo.OCLG T0 group by DocNum)) T0

RIGHT OUTER JOIN

dbo.OQUT AS T1 ON T0.DocNum = T1.DocNum

LEFT JOIN

dbo.ocrd AS T3 ON T1.CardCode = T3.CardCode

INNER JOIN OSLP T4 ON T3.SlpCode = T4.SlpCode

where t1.Series ='223'