Re: joins issues again

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 8, 2008 at 7:28 AM, Steven Macintyre
<steven@xxxxxxxxxxxxxxxxxxxxx> wrote:
>  I have the following SQL statement;

... and this relates to PHP how?

>  SELECT count( salesID ) AS count, branch_name, company_name, branch.branchID

That doesn't make sense.  You're selecting a group function (COUNT)
along with other columns which you're not grouping on.   It might help
if you told us what you were trying to accomplish with the query.

But you'd be better off asking on a SQL list instead of a PHP one.


>         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.

So why are you joining in the first place?

-- 
Mark J. Reed <markjreed@xxxxxxxx>

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux