我正在尝试创建一个sql语句
SELECT ACTIVITY_ID, ACTIVITY_DESCRIPTION,
我选择了任务活动,因为它将4个表连接在一起
COUNT(*) NAME AS NAMECount
我使用上面的count语句来计算志愿者人数
DESCRIPTION AS TASK
FROM
这是内连接
TASK_ACTIVITY
INNER JOIN
VOLUNTEER ON VOLUNTEER.VOLUNTEER_ID = TASK_ACTIVITY.VOLUNTEER_ID
INNER JOIN
TASK ON TASK.TASK_ID = TASK_ACTIVITY.TASK_ID
GROUP BY VOLUNTEER.NAME;
我收到此错误
ORA-00923:未找到FROM关键字
答案 0 :(得分:0)
您可以使用以下查询。提供列名称中的别名和按列分组以使其工作,因为您没有提到哪个列属于哪个表
SELECT ACTIVITY_ID,
ACTIVITY_DESCRIPTION,
COUNT(*), NAME AS NAMECount,
DESCRIPTION AS TASK
FROM TASK_ACTIVITY TASK_ACTIVITY
INNER JOIN
VOLUNTEER VOLUNTEER
ON VOLUNTEER.VOLUNTEER_ID = TASK_ACTIVITY.VOLUNTEER_ID
INNER JOIN
TASK ON TASK.TASK_ID = TASK_ACTIVITY.TASK_ID
GROUP BY ACTIVITY_ID, ACTIVITY_DESCRIPTION, TASK, VOLUNTEER.NAME;