Betty
2006-09-04 12:29:25 UTC
Afternoon,
I am having trouble with the following code due to a syntax error near
'End'. But i cannot see why it has an error.
The code should display in two separate columns the total amount of
'Leads' raised by Joe Bloggs.
Code as follows...
SELECT AWD.EmpName, IsNull(FirstMonth.Leads,0) as FirstMonthLeads,
IsNull(SecondMonth.Leads,0) as SecondMonthLeads
select EmpName,
Case (IsNull(Sum(Leads),0)) End as Leads
from AgentWorkDetail
Where Timesheetdate between
Case When month(current_timestamp)=9 Then '20060701' End
and
Case When month(current_timestamp)=9 Then '20060731' End
group by EmpName
) as FirstMonth on Firstmonth.EmpName = AWD.EmpName
Left Outer Join (
select EmpName,
Case (IsNull(Sum(Leads),0)) End as Leads
from AgentWorkDetail
Where Timesheetdate between
Case When month(current_timestamp)=9 Then '20060801' End
and
Case When month(current_timestamp)=9 Then '20060831' End
group by EmpName
) as SecondMonth on Secondmonth.EmpName = AWD.EmpName
Where AWD.empname = 'Joe Bloggs'
group by AWD.EmpName, FirstMonth.Leads, SecondMonth.Leads
Can anyone help?
I am having trouble with the following code due to a syntax error near
'End'. But i cannot see why it has an error.
The code should display in two separate columns the total amount of
'Leads' raised by Joe Bloggs.
Code as follows...
SELECT AWD.EmpName, IsNull(FirstMonth.Leads,0) as FirstMonthLeads,
IsNull(SecondMonth.Leads,0) as SecondMonthLeads
From AgentworkDetail AWD
Left Outer Join (select EmpName,
Case (IsNull(Sum(Leads),0)) End as Leads
from AgentWorkDetail
Where Timesheetdate between
Case When month(current_timestamp)=9 Then '20060701' End
and
Case When month(current_timestamp)=9 Then '20060731' End
group by EmpName
) as FirstMonth on Firstmonth.EmpName = AWD.EmpName
Left Outer Join (
select EmpName,
Case (IsNull(Sum(Leads),0)) End as Leads
from AgentWorkDetail
Where Timesheetdate between
Case When month(current_timestamp)=9 Then '20060801' End
and
Case When month(current_timestamp)=9 Then '20060831' End
group by EmpName
) as SecondMonth on Secondmonth.EmpName = AWD.EmpName
Where AWD.empname = 'Joe Bloggs'
group by AWD.EmpName, FirstMonth.Leads, SecondMonth.Leads
Can anyone help?