Hi,
Here's the problem... I need to identify the deduction amount of people within a predetermined population who have a 401(k) deduction, but I want to return ALL the population in the results even if they do not have a deduction.
The tables are...
EBase - holds master record information - one record per employee
EDeduct - holds employee level deduction records. May have multiple deductions per employee. The current record has a null end date.
Deduction - holds system level deduction information
The relationships between tables are...
EBase.Ebflxid = EDeduct.Deeflxideb
Deduction.dedflxid = EDeduct.Deeflxidded
I constructed the following query...
select b.ebpsid, b.ebflxid, b.ebclock, b.eblastname, b.ebfirstname, e.deeamount
from ebase b left join ededuct e on b.flxid = e.deeflxideb,
join deduction d on d.dedflxid = e.deeflxidded
where d.dedcode = '401K' and e.deedateend is null and b.ebflxid in(<list of values here>)
I'm running SQL Server 7 and when I run the query I get an error message stating "Incorrect syntax near the keyword 'join'."
I've reviewed the syntax in a couple of books and am having trouble figuring out what I've done wrong. Any advice would be appreciated!
Thanks,
Barb
Here's the problem... I need to identify the deduction amount of people within a predetermined population who have a 401(k) deduction, but I want to return ALL the population in the results even if they do not have a deduction.
The tables are...
EBase - holds master record information - one record per employee
EDeduct - holds employee level deduction records. May have multiple deductions per employee. The current record has a null end date.
Deduction - holds system level deduction information
The relationships between tables are...
EBase.Ebflxid = EDeduct.Deeflxideb
Deduction.dedflxid = EDeduct.Deeflxidded
I constructed the following query...
select b.ebpsid, b.ebflxid, b.ebclock, b.eblastname, b.ebfirstname, e.deeamount
from ebase b left join ededuct e on b.flxid = e.deeflxideb,
join deduction d on d.dedflxid = e.deeflxidded
where d.dedcode = '401K' and e.deedateend is null and b.ebflxid in(<list of values here>)
I'm running SQL Server 7 and when I run the query I get an error message stating "Incorrect syntax near the keyword 'join'."
I've reviewed the syntax in a couple of books and am having trouble figuring out what I've done wrong. Any advice would be appreciated!
Thanks,
Barb