MySQL Forums
Forum List  »  Install & Repo

SQL statement is failing. Why?
Posted by: Rich Bernstein
Date: August 16, 2020 11:08AM

I am trying to run the following statement:
SELECT cc.cost_center_name, cc.qualified_percent, SUM(e.w2_wages) as qualified_amount
FROM cost_center as cc,employees as e
WHERE e.email='$email' AND e.campaign='$campaign'
AND cc.email='$email' AND cc.campaign='$campaign'
AND cc.cost_center_name=e.department

This is supposed to get total all the wages for employees in each cost center. Instead it returns just this:
cost_center_name qualified_percent qualified_amount
test 0 267,000

"test" is one of the cost centers, but there are about 30 more. Why is it just doing "test"?

Options: ReplyQuote


Subject
Written By
Posted
SQL statement is failing. Why?
August 16, 2020 11:08AM


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.