Friday, February 24, 2012

I need help with query string Parser error

I can not get this query to work can some on help me?

SELECT count(JOBID) AS 'transcount', count(distinct patientid) AS 'patient count', sum(TRANSPORTATION_TCOST)
AS 'tcost,
sum(TRANSPORTATION_DISC_COST) as ' dtcost ',
avg(TRANSPORTATION_DISC) as "avgTDisc",
(sum(transportation_tcost) + sum(TRANSPORTATION_DISC_COST)) as "TGrossAMTBilled',
(sum(transportation_tcost) / count(DISTINCT patientid)) AS 'PatAvgT', sum(TRANSPORTATION_DISC) AS 'avgPercentDiscT' job.JURSDICTION
FROM job LEFT JOIN
payer ON payer.payerid = job.payerid LEFT JOIN
states ON job.jurisdiction = states.initials
WHERE (job.transportation = '1') AND ((job.datedcreated = @.startdate) AND (job.datecreated = @.enddate)) AND states.region = 'GA'
GROUP BY job.JURISDICTION
ORDER BY PatAvgT DESC

Please include the specific error message you are getting. Just browsing at the query I see a missing quote from:

AS 'tcost,

|||

In addition to Cloris' post above, you have used a mix of double quotes/single quotes for alias column names. You dont need to use any quotes for alias.

No comments:

Post a Comment