我可以在我的考试项目中使用一些帮助,我的SQL查询有问题,根据他们所在的公会(id)获取志愿者名单(id),这是一个多对多的关系,并决定使用' Inner Join'告诉我的java程序彼此之间的id是什么,但是当我运行它时,它会给我错误' com.microsoft.sqlserver.jdbc.SQLServerException:索引1超出范围。 '哪个假设意味着我试图显示的列表是空的?有什么直接的想法吗?
这是图表中3个表之间的多对多关系:
基于公会获取志愿者的查询,第一次使用Inner Join语句,所以我可能忽略了一个错误,
答案 0 :(得分:1)
在串联的开头/结尾看起来你需要更多空格。
您还需要使用逗号选择列,而不是and
。
e.g。 select firstname, lastname
...而不是select firstname and lastname ...