sysadmin42
Technical User
- May 6, 2005
- 138
Hi. here's the code:
This gives me exactly what I want: the sums of 'high_estimate' and 'low_estimate' for items that match the subquery.
Is there a way to get all that into the query? or at the very least simplify my PHP?
The first thing I tried was:
but it kept giving me errors. Any thoughts?
Code:
$result=doQuery("SELECT high_estimate,low_estimate FROM projects WHERE status IN (SELECT id FROM project_status WHERE name LIKE '%In Progress%')");
while ($line=mysql_fetch_assoc($result)) {
$high+=$line['high_estimate'];
$low+=$line['low_estimate'];
}
This gives me exactly what I want: the sums of 'high_estimate' and 'low_estimate' for items that match the subquery.
Is there a way to get all that into the query? or at the very least simplify my PHP?
The first thing I tried was:
Code:
SELECT SUM(high_estimate) AS high_estimate FROM projects WHERE status IN (SELECT id FROM project_status WHERE name LIKE '%In Progress%');