joins issues again
| From: | Steven Macintyre | Date: | Tue, 08 Apr 2008 11:28:23 +0000 |
| Subject: | joins issues again | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-272693@lists.php.net to get a copy of this message | ||
Hi all,
I have the following SQL statement;
SELECT count( salesID ) AS count, branch_name, company_name, branch.branchID
FROM sales
LEFT JOIN IGuser ON sales.IGuid = IGuser.IGuid
LEFT JOIN branch ON IGuser.branchID = branch.branchID
LEFT JOIN company ON branch.companyID = '{$companyID}'
WHERE maincompanyid = '{$mcid}'
GROUP BY branch.branchID
ORDER BY branch_name ASC
However, i do not want those join records to be appended, only to return the count of records from
sales.
Can someone assist me with this? I have tried differance variants of joins and none of the results
are correct.
Sales tbl doesnt have the companyID, nor does IGuser
Regards,
Steven