mysql7个字段怎么用左连接求出另一张表的和 - 爱问答

(爱问答)

mysql7个字段怎么用左连接求出另一张表的和

select count(qtym2),c1.zgx1 from lsh_plan,(select count(qtym2) AS zgx1 from lsh_plan

left join w.wip

on lsh_plan.process=wip.process and (LSH_PLAN.Ledger1 =w.wip.ledger or LSH_PLAN.Ledger2 =w.wip.ledger or LSH_PLAN.Ledger3 =w.wip.ledger or LSH_PLAN.Ledger4 =w.wip.ledger or LSH_PLAN.Ledger5 =w.wip.ledger) group by id ) as c1

left join w.wip

on lsh_plan.gx2=wip.process and (LSH_PLAN.Ledger1 =w.wip.ledger or LSH_PLAN.Ledger2 =w.wip.ledger or LSH_PLAN.Ledger3 =w.wip.ledger or LSH_PLAN.Ledger4 =w.wip.ledger or LSH_PLAN.Ledger5 =w.wip.ledger) group by id 


例如: select *from CT_CYK_CustomerBaseInfoLEFT OUTER JOIN T_BD_Customer ON CT_CYK_CustomerBaseInfo.CFCustNameID=T_BD_Customer.FIDand CT_CYK_CustomerBaseInfo.CFMainLinkMenID=T_BD_Customer.FID;把客户的基本信息表进行的重新命名,然后修改了sql语句,取得成功,结果如下:select *from CT_CYK_CustomerBaseInfoLEFT OUTER JOIN T_BD_Customer ON CT_CYK_CustomerBaseInfo.CFCustNameID=T_BD_Customer.FIDLEFT OUTER JOIN T_BD_Customer as linkpeople ONCT_CYK_CustomerBaseInfo.CFMainLinkMenID=linkpeople.FID;这样就实现了在一个数据库表中同时两次左联接。

相关标签:mysql

下一篇:0基础前端要仿一个京东的静态页面,没有js那种要多久?

上一篇:vs2017无法识别dump文件??

热门标签:
excel 网盘 破解 word dll
最新更新:
微软重新评估新的Outlook的使用时机 联想推出搭载联发科Helio G80芯片组的Tab M9平板 英特尔创新大赛时间确定! 微软Edge浏览器在稳定渠道中推出Workspaces功能 英伟达RTX4060TiGPU推出MaxSun动漫主题! 谷歌地图为用户提供了街景服务! GameSir 在T4 Kaleid中推出了一款出色的控制器! 微软开始在Windows 11 中测试其画图应用程序的新深色模式! LG电子推出全球首款无线OLED电视 英伟达人工智能芯片崭露头角! Steam Deck可以玩什么游戏-Steam Deck价格限时优惠 雷蛇推出CobraPro鼠标 Kindle电子阅读器可以访问谷歌商店吗 Windows10如何加入组策略 window10图片查看器怎么没有了?