Re: Query Sum problem

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

 



From: "Larry Sandwick" <lgs@xxxxxxxxxxx>

> I appreciate the quick response, but I should have been more clear.
>
> I understand the query below, but I would only have 2 total and it is
> not group by the companies.
>
> The query below gives me the main information without totals.
>
> How do I add the 2 totals to the query below?
>
> SELECT DISTINCT(Company), account, City, State FROM Table WHERE number =
> 100

SELECT Company, Account, City, State, SUM(IF(Status='Held',Cost,0)) AS Held,
SUM(IF(Status='Open',Cost,0)) AS Cost FROM Table WHERE Number = 100

---John Holmes...

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux