以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  select语句  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=175935)

--  作者:125651911
--  发布时间:2022/3/24 13:20:00
--  select语句
Select a.bh as 产品编号, a.mc as 名称, sum(b.sl) As 出库数量, sum(b.sl) As 入库数量
fro m cp a
left join ck b on a.bh = b.bh
left join rk c on a.bh = c.bh
group by a.bh, a.mc

语法错误 (操作符丢失) 在查询表达式 \'a.bh = b.bh
left join rk c on a.bh = c.bh\' 中。

select 不可以连接多个表吗?

--  作者:有点蓝
--  发布时间:2022/3/24 13:42:00
--  
内部表,和access要这样

Select a.bh as 产品编号, a.mc as 名称, sum(b.sl) As 出库数量, sum(b.sl) As 入库数量
from (cp a
left join ck b on a.bh = b.bh)
left join rk c on a.bh = c.bh
group by a.bh, a.mc

其实上面sql根本没有用到c表,可以去掉这个表的关联

--  作者:125651911
--  发布时间:2022/3/24 13:46:00
--  

 sum(b.sl) As 出库数量, sum(c.sl) As 入库数量

收到,感谢!