renee35
MIS
- Jan 30, 2007
- 199
Below is the code that I am receiving this erorr for:
Server: Msg 156, Level 15, State 1, Line 21
Incorrect syntax near the keyword 'Group'.
Please help because I cannot seem to figure it out!
Create table #vacationpay_types (paycodeid int, paycodedesc varchar (255))
insert into #vacationpay_types (paycodeid, paycodedesc)
(
select
paycodedesc,
'Group' = Case when s.paycodeid in (29, 35, 282, 288, 333, 339, 1955, 1961, 10035, 10036) then 'Vacation'
when s.paycodeid in (24, 34, 103, 277, 287, 330, 338, 1950, 1960, 10011, 10012, 10023, 10038) then 'Holiday' END
from syspaycodes s
where (paycodedesc like 'Holi%' or paycodedesc like 'Vaca%')
)
SELECT
p.PCDesc,
c.Name,
v.SSNDisp,
v.EmpNameLFM,
v.EffDate,
v.WeekEnd,
y.Group,
Sum(v.PayUnits) AS Units,
Sum(v.PRAmt) AS Pay,
Sum(v.BillAmt) AS Bill
FROM (#vacationpay_types y INNER JOIN ((custCustomer c INNER JOIN vw_RptUSAMstr v ON c.CustID = v.CustID)
INNER JOIN sysPayCodes s ON v.PayCodeID = s.PayCodeID) ON y.PayCodeDesc = s.PayCodeDesc)
INNER JOIN SSProfitCenter p ON v.PCID = p.PCID
WHERE v.EffDate Between '2009-1-1' And '2009-1-15'
GROUP BY p.PCDesc, c.Name, v.SSNDisp, v.EmpNameLFM, v.EffDate, v.WeekEnd, y.Group
ORDER BY p.PCDesc, c.Name
Thanks a bunch!!
-T
Server: Msg 156, Level 15, State 1, Line 21
Incorrect syntax near the keyword 'Group'.
Please help because I cannot seem to figure it out!
Create table #vacationpay_types (paycodeid int, paycodedesc varchar (255))
insert into #vacationpay_types (paycodeid, paycodedesc)
(
select
paycodedesc,
'Group' = Case when s.paycodeid in (29, 35, 282, 288, 333, 339, 1955, 1961, 10035, 10036) then 'Vacation'
when s.paycodeid in (24, 34, 103, 277, 287, 330, 338, 1950, 1960, 10011, 10012, 10023, 10038) then 'Holiday' END
from syspaycodes s
where (paycodedesc like 'Holi%' or paycodedesc like 'Vaca%')
)
SELECT
p.PCDesc,
c.Name,
v.SSNDisp,
v.EmpNameLFM,
v.EffDate,
v.WeekEnd,
y.Group,
Sum(v.PayUnits) AS Units,
Sum(v.PRAmt) AS Pay,
Sum(v.BillAmt) AS Bill
FROM (#vacationpay_types y INNER JOIN ((custCustomer c INNER JOIN vw_RptUSAMstr v ON c.CustID = v.CustID)
INNER JOIN sysPayCodes s ON v.PayCodeID = s.PayCodeID) ON y.PayCodeDesc = s.PayCodeDesc)
INNER JOIN SSProfitCenter p ON v.PCID = p.PCID
WHERE v.EffDate Between '2009-1-1' And '2009-1-15'
GROUP BY p.PCDesc, c.Name, v.SSNDisp, v.EmpNameLFM, v.EffDate, v.WeekEnd, y.Group
ORDER BY p.PCDesc, c.Name
Thanks a bunch!!
-T