Same table repeat in from clause
How do we write query where the same table is repeated more than once since that table has to be join with more than one table .Pls advise.
Gordon Du replied
You can try this rewrite query to see if the results are the same:
SELECT DISTINCT T1.DocEntry 'GR No', T1.ItemCode 'Part No.', T1.Dscription 'Part Description', T0.SuppSerial 'DateCode', T0.Quantity 'Qty', T2.Custom,T1.Price, T2.Cost FROM PDN1 T1 LEFT JOIN IPF1 T2 ON T2.BaseEntry = T1.DocEntry AND T1.ItemCode = T2.ItemCode AND T2.Origline = T1.LineNum LEFT JOIN OIBT T0 ON T1.LineNum = T0.BaseLinNum AND T0.BaseNum = T1.DocEntry AND T0.ItemCode = T1.ItemCode
There are not two alias but one. If you still has duplicate records, it means you have to omit the column with difference data if you can.