在没有between
的情况下收到错误说明and
运营商,但我有一个and
,所以我不明白。提前谢谢
select
a.student_name, a.test_score, b.letter_grade
from
sec1311_student_scores a
inner join
sec1311_grade_ranges b on a.testscore between b.beginning_score and b.endingscore
order by
a.student_name;
答案 0 :(得分:2)
Access不支持join子句中的BETWEEN
。来自the documentation:
FROM table1 INNER JOIN table2 ON table1.field1 compopr table2.field2
The INNER JOIN operation has these parts:
Part | Description
---- | -------------
table1, table2 | The names of the tables from which records are combined.
field1, field2 | The names of the fields that are joined. If they are not numeric, the fields must be of the same data type and contain the same kind of data, but they do not have to have the same name.
compopr | Any relational comparison operator: "=," "<," ">," "<=," ">=," or "<>."
但是,您可以指定多个加入条件,因此您应该可以这样做:
select
a.student_name, a.test_score, b.letter_grade
from
sec1311_student_scores a
inner join
sec1311_grade_ranges b on a.testscore >= b.beginning_score
and on a.testscore <= b.endingscore
order by
a.student_name;
答案 1 :(得分:1)
试试这个:
select
a.student_name, a.test_score, b.letter_grade
from
sec1311_student_scores as a,
sec1311_grade_ranges as b
where
a.testscore between b.beginning_score and b.ending_score
order by
a.student_name;