I have a query that join 4 tables like this :
SELECT A.NO_COMM,
B.CODE_ART,
C.NO_PROJ,
D.RSN_SOC
FROM ACH_COMM AS A LEFT OUTER JOIN
ACH_COMM_ITEM AS B ON B.NO_COMM = A.NO_COMM JOIN
FIN_FOUR AS C ON C.NO_FOUR = A.NO_FOUR JOIN
ACH_COMM_ITEM_CMPT AS D ON D.NO_ITEM_COMM = B.NO_ITEM_COMM
WHERE ...Whatever
GROUP BY ...Everything
What i wanted to happens here is the following :
All the rows of table A are returned only once with the information of the other tables if those exist. So the number of rows returned should be equal to the amount of record in A. The NO_COMM
witch is the primary key of table A shouldn't be displayed twice with the same number.
But i have the same NO_COMM
displayed 167 times... a left join should be returning everything from the left table only once ? No ?
The real problem was the fact that an outer left join do not nessecarly end up returning a single row for each of the left table record.