1,A,B,B,7
2,A,B,B,7
3,A,B,C,11个
4,b,a,a,21
1,A,B,B,3
2,A,B,C,12个
3,b,a,a,4
问题:显示结果集,如果表[2] d<表[一]加入s,i,e。
期望的结果:表[2] s,i,e,d表[1] d基于s
任何帮助都会很棒,我不熟悉Access语法。
答案 0 :(得分:1)
使用Access查询设计器的Design View来构建查询。您可以通过切换到SQL View来检查它产生的语法。
如果我正确理解了这些要求,那么这个SQL可能就是你想要的:
SELECT
t2.s,
t2.i,
t2.e,
t2.d AS t2_d,
t1.d AS t1_d
FROM
Table1 AS t1
INNER JOIN Table2 AS t2
ON
t1.s = t2.s
AND t1.i = t2.i
AND t1.e = t2.e
WHERE t2.d < t1.d
答案 1 :(得分:1)
SELECT two.*, one.d
FROM one INNER JOIN two on one.s = two.s AND one.i = two.i AND two one.e = two.e
WHERE two.d < one.d