Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help WIth Error

Status
Not open for further replies.

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top