SELECT audit_trail.vendor,
SUM(audit_trail.quantity),
sdmn.reject,
vendor.code
FROM vendor LEFT OUTER JOIN sdmn ON
vendor.code = sdmn.supplier AND
sdmn.day >= '10/01/02' AND
sdmn.day <= '10/30/02',
vendor LEFT OUTER JOIN audit_trail ON
vendor.code = audit_trail.vendor AND
audit_trail.type = 'R' AND
audit_trail.date_stamp >= '10/01/02' AND audit_trail.date_stamp <= '10/30/02'
WHERE vendor.code = 'WHI018'
GROUP BY audit_trail.vendor,
sdmn.reject,
vendor.code
when I execute the above query I get this error:
Tables or functions 'vendor' and 'vendor' have the same exposed names. Use correlation names to distinguish them.
What does this mean? I thought it meant that sql server didn't know whether to use the vendor in the first or second join. If I am right how can I fix this problem?
Thanks for your help
SUM(audit_trail.quantity),
sdmn.reject,
vendor.code
FROM vendor LEFT OUTER JOIN sdmn ON
vendor.code = sdmn.supplier AND
sdmn.day >= '10/01/02' AND
sdmn.day <= '10/30/02',
vendor LEFT OUTER JOIN audit_trail ON
vendor.code = audit_trail.vendor AND
audit_trail.type = 'R' AND
audit_trail.date_stamp >= '10/01/02' AND audit_trail.date_stamp <= '10/30/02'
WHERE vendor.code = 'WHI018'
GROUP BY audit_trail.vendor,
sdmn.reject,
vendor.code
when I execute the above query I get this error:
Tables or functions 'vendor' and 'vendor' have the same exposed names. Use correlation names to distinguish them.
What does this mean? I thought it meant that sql server didn't know whether to use the vendor in the first or second join. If I am right how can I fix this problem?
Thanks for your help