MySQL Forums
Forum List  »  Newbie

select syntax with condition
Posted by: Remi Fritzen
Date: June 09, 2005 11:12PM

Hi everybody
here is the query that I wanna modify :

SELECT sum(t.Cost) AS Cost, sum(t.Duration) AS Duration,p.*, c.Name AS ClientName, u.FirstName, u.LastName, u.EmailAddress
FROM tblProjects p
INNER JOIN tblClients c ON c.ID = p.ClientID
LEFT JOIN tblUsers u ON u.ID = p.Owner
LEFT JOIN tblTasks t ON t.ProjectID = p.ID
WHERE p.ID = '83' GROUP BY p.ID

I'd like add to add to the sum for the duration only when the cost is 0, and keep the sum of the cost like that :

so
ID Cost Duration ....
1 0
2 0
3 30

Options: ReplyQuote


Subject
Written By
Posted
select syntax with condition
June 09, 2005 11:12PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.