我有这个查询
<cfquery datasource="Intranet" name="getMaxstars">
SELECT TOP (1) WITH TIES emp_id, SUM(execoffice_status) AS total_max
FROM CSEReduxResponses
GROUP BY emp_id
ORDER BY total_max DESC
</cfquery >
<cfquery datasource="phonelist" name="getEmployees">
SELECT first_name, last_name, emp_id
FROM employee
</cfquery>
<!--- Query of a query join --->
<cfquery name="getEmployeeStars" dbtype="query">
SELECT getEmployees.first_name + ' ' + getEmployees.last_name AS full_name, getMaxstars.total_max AS stars
FROM getMaxstars, getEmployees
WHERE getMaxstars.emp_id = getEmployees.emp_id
</cfquery>
在这个查询中,我想在 CSEReduxResonses 表中获取 emp_id 的最大值,我想得到的是输出只有员工表具有的员工的全名以及该员工有多少星星(execoffice_status)。所以输出看起来像这样:
约翰多伊 4
我不断收到此错误:
查询的查询语法错误。遇到“。不正确的选择列表,不正确的选择列,getEmployees.emp_namefirst后面不能跟'+'
错误发生在 C:\inetpub\wwwroot\WebServer\win\test\cse_execoffice_newsletter.cfm:第 60 行
58 :
59 : 60 : 61 : SELECT getEmployees.emp_namefirst + ' ' + getEmployees.emp_namelast AS full_name, getMaxstars.total_max AS [stars] 62: FROM getMaxstars, getEmployees