首页 > 解决方案 > Need help Inner join and where condition

问题描述

I don't know why below codes did not work.

Problem: Using INNER JOIN, find the minimum “Average Student Attendance” for a community is where hardship is 96

SELECT b.Community_Area_Name, min(b.Average_Student_Attendance) FROM CENSUS_DATA as a 
INNER JOIN CHICAGO_PUBLIC_SCHOOLS as b
ON a.Community_Area_Number =b.Community_Area_Number
WHERE a.hardship_index=96
GROUP BY b.Community_Area_Name

Error in jupyter notebook:

File "", line 2 INNER JOIN CHICAGO_PUBLIC_SCHOOLS as b ^ SyntaxError: invalid syntax

Error in SQL server:

"A.COMMUNITY_AREA_NUMBER" is not valid in the context where it is used.. SQLCODE=-206, SQLSTATE=42703, DRIVER=4.22.36

标签: sqlsql-serverjupyter-notebook

解决方案


我也有同样的问题。我设法做到了。该问题在文章“使用真实数据集”第 4 周中进行了描述。我们需要在查询中使用双引号。像这样的东西

SELECT MIN("Average_Student_Attendance")

推荐阅读