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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incorrect Syntax

Status
Not open for further replies.
Dec 11, 2009
60
US
I am getting this error;

Incorrect syntax near '–'

For this code and cannot figure out what am I doing wrong:

Select clientid, r.orderid, r.totalactive

CASE WHEN totalplaced > totalactive then totalactive else totalplaced end
as OpeningsPerOrder
From
(
select clientid, o.orderid,
SUM(Case when o.startdate < @enddate and oc.enddate > @startdate
then o.originalopenings end) as totalactive
from orders o
inner join ordercandidates oc on oc.orderid = o.orderid
where o.statusid in (144,157) and o.startdate IS NOT NULL
Group by clientid, o.orderid
)r

inner join
(
Select orderid, count(candidateid) as totalplaced
from ordercandidates where startingdate < @enddate and enddate > @startdate
Group by orderid
) r2 ON r2.orderid = r.orderid
group by r.clientid, r.orderid, totalactive

It points to this part of the code:

r.totalactive – CASE WHEN totalplaced > totalactive then totalactive else totalplaced END

Any suggestions? Thanks!!!
 
Nevermind I got it. I guess I needed to type it to figure it out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top