On Tue, Apr 8, 2008 at 7:28 AM, Steven Macintyre
<[EMAIL PROTECTED]> wrote:
>  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

    Steven,

    Since this isn't a PHP-specific question, you'll probably receive
better responses on either the MySQL list (you didn't mention which
database system you're using, but I'll blindly and ignorantly assume
that's it), or at least the PHP-DB list.  I'm CC'ing both of those for
you.

-- 
</Daniel P. Brown>
Ask me about:
Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo.,
and shared hosting starting @ $2.50/mo.
Unmanaged, managed, and fully-managed!

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to