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'$email' AND e.campaign='$campaign'
AND'$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

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

Sorry, only registered users may post in this forum.

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.