gpt4 book ai didi

php - 来自多个表的多个总和

转载 作者:行者123 更新时间:2023-11-29 19:11:24 26 4
gpt4 key购买 nike

我一直在尝试将每个表中的总数加在一起。我使用过在线查询生成器,但我认为它不正确。

"SELECT SUM(total) mailTotal,
SUM(total) extraTotal,
SUM(total) fbaTotal,
SUM(total) gdnTotal,
SUM(total) ppcTotal,
SUM(total) smTotal,
SUM(total) webTotal
FROM admail,
extra_charges,
facebook_adds,
gdn,
ppc,
social_media,
web
WHERE client = 1"

最佳答案

您应该需要像下面这样尝试:

SELECT SUM(ad.total)  as mailTotal,
SUM(ex.total) as extraTotal,
SUM(fa.total) as fbaTotal,
SUM(gdn.total) as gdnTotal,
SUM(ppc.total) as ppcTotal,
SUM(sm.total) as smTotal,
SUM(w.total) as webTotal
FROM admail ad,
extra_charges ex,
facebook_adds fa,
gdn gdn,
ppc ppc,
social_media sm,
web w
WHERE ad.client = 1

这肯定适合你:)

关于php - 来自多个表的多个总和,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43050076/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com