三个表在SQL中连接
我是 SQL 新手。我想用 SQL 连接三个表。以下是我的查询,请检查并纠正我错误的地方 -
表:
- CARD:ID,Code,Name,CC
- PGM:ID,Code
- PGMeCode:ID,Code,CC
查询:
Select *
FROM CARD
INNER JOIN PGMeCode PGMeCode.Code = CARD.Code AND PGMeCode.CC = CARD.CC
INNER JOIN PGM PGM.Code = Card.Code
WHERE Card.ID = 'SomeThing'
我不知道我做错了什么。请推荐我!!
提前致谢。
I am newbie in SQL. I want to join three tables in SQL. Below is my query, please check and correct me where I am wrong -
Tables:
- CARD: ID,Code,Name,CC
- PGM: ID,Code
- PGMeCode: ID,Code,CC
Query:
Select *
FROM CARD
INNER JOIN PGMeCode PGMeCode.Code = CARD.Code AND PGMeCode.CC = CARD.CC
INNER JOIN PGM PGM.Code = Card.Code
WHERE Card.ID = 'SomeThing'
I don't know what I am doing wrong. Please suggest me!!
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您缺少放置在表名称后面的关键字
ON
。You are missing the keyword
ON
, placed after the table name.尝试这个查询
Try this query