需要帮助内在加入以及条件 [英] Need help Inner join and where condition

查看:73
本文介绍了需要帮助内在加入以及条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么下面的代码不起作用.

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

问题:使用INNER JOIN,找到一个困难程度为96的社区的最低平均学生出勤率"

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

jupyter笔记本电脑中的错误:

Error in jupyter notebook:

文件",第2行INNER JOIN CHICAGO_PUBLIC_SCHOOLS as b ^ SyntaxError:语法无效

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

SQL服务器错误:

"A.COMMUNITY_AREA_NUMBER"在使用的上下文中无效..SQLCODE = -206,SQLSTATE = 42703,DRIVER = 4.22.36

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

推荐答案

双引号将解决您的问题,但是我发现当我双引号Hardship_Index时,出现错误.但是下面的代码可在Jupyter上使用.

Doublequotes will solve your problem, but what i found is when i doublequote Hardship_Index, i got error. But below code works on Jupyter.

%sql select min(PS."Average_Student_Attendance"), CD.Hardship_Index  from CENSUS_DATA as CD INNER JOIN CHICAGO_PUBLIC_SCHOOLS as PS ON CD."Community_Area_Number" =PS."Community_Area_Number" WHERE CD.Hardship_Index = 96 GROUP BY CD.Hardship_Index

这篇关于需要帮助内在加入以及条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆