Hi Sudhir,
Try:
SELECT Distinct T1.DocNum Invoice#, T3.docnum DO#, t5.docnum SO#
FROM INV1 T0 INNER JOIN OINV T1 ON T0.DocEntry = T1.DocEntry
left join DLN1 T2 on T0.[BaseEntry] = T2.docentry and T0.[BaseLine] = T2.[LineNum] and T0.[BaseType] = 15 left JOIN ODLN T3 ON T2.DocEntry = T3.DocEntry left join RDR1 T4 on (T2.Basetype=17 and T2.BaseEntry=T4.DocEntry) OR (T0.Basetype=17 AND T0.BaseEntry=T4.DocEntry) left JOIN ORDR T5 ON T4.DocEntry = T5.DocEntry
Thanks,
Gordon