我的查询有问题吗?我错误地使用了内部加入吗?

时间:2017-05-10 18:33:02

标签: java sql

我可以在我的考试项目中使用一些帮助,我的SQL查询有问题,根据他们所在的公会(id)获取志愿者名单(id),这是一个多对多的关系,并决定使用' Inner Join'告诉我的java程序彼此之间的id是什么,但是当我运行它时,它会给我错误' com.microsoft.sqlserver.jdbc.SQLServerException:索引1超出范围。 '哪个假设意味着我试图显示的列表是空的?有什么直接的想法吗?

这是图表中3个表之间的多对多关系:

This is the many to many relationship between the 3 tables in diagram

基于公会获取志愿者的查询,第一次使用Inner Join语句,所以我可能忽略了一个错误, The query to get the volunteer based on guild, first time using the Inner Join statement, so there might be an error here I have overlooked

1 个答案:

答案 0 :(得分:1)

在串联的开头/结尾看起来你需要更多空格。

您还需要使用逗号选择列,而不是and

e.g。 select firstname, lastname ...而不是select firstname and lastname ...