sql语句的语法错误,高分求解 关于left join !!!!!!!!!!

2024-12-12 08:23:23
推荐回答(2个)
回答1:

access 的多个left join 要加括号:
如:
select * from ((A left join B on A.id=B.id) left join C on A.id=C.id)

select member.mid,name,sex,shen,birth,phone,deli_date,sum(total) as total_all,sum(point)-sum(kill) as point_after,bname from ([member] left join [sell] on member.mid=sell.mid) left join [branch] on member.bid=branch.bid where member.mid like '8%%' group by member.mid,name,sex,shen,birth,phone,deli_date,bname

回答2:

我机子编译可以通过(kill加上中括号),你把SQL写规范了就很明了了
select member.mid,
name,
sex,
shen,
birth,
phone,
deli_date,
sum(total) as total_all,
(sum(point) - sum([kill])) as point_after,
bname
from member
left join sell on member.mid = sell.mid
left join branch on member.bid = branch.bid
where member.mid like '8%%'
group by member.mid, name, sex, shen, birth, phone, deli_date, bname