我需要从多个表格中获得总价格。
这是SQL SERVER查询
Select
sum(Tbl_StartupBanner.Price + Tbl_SignInBanner.Price + Tbl_SignOutBanner.Price) as Total
from Tbl_StartupBanner,Tbl_SignInBanner,Tbl_SignOutBanner
Tbl_StartupBanner - Price Value - 1 Tbl_SignInBanner - Price Value - 1 Tbl_SignOutBanner - Price Value is None .. There is No record in This table ...
但我需要的总数是:2
答案 0 :(得分:0)
试试这个
SELECT TableA.Column1 + TableB.Column2 FROM TableA
LEFT JOIN TableB ON TableA.MatchingColumn = TableB.MatchingColumn
答案 1 :(得分:0)
Select
ISNULL(t1.Price, 0) + ISNULL(t2.Price, 0) + ISNULL(t3.Price, 0) as Total
from Tbl_StartupBanner t1
LEFT JOIN Tbl_SignInBanner t2 ON t1.MatchCol = t2.MatchCol
LEFT JOIN Tbl_SignOutBanner t3 ON t1.MatchCol = t2.MatchCol