尝试将表A与表B相乘。在表A列Total
Ex:查询Activity 1
STD Time
来自Table B
和Activity 2
{{1}来自STD time
答案 0 :(得分:0)
要执行乘法,您需要使用union all
:
select *, (tb.STDTime * t.Time) as MultiTime
from (
select TeamName, 'Activity1' as Activity, Activity1 as Time
from tableA UNION ALL
select TeamName, 'Activity2' as Activity, Activity2 as Time
from tableA UNION ALL
select TeamName, 'Activity3' as Activity, Activity3 as Time
from tableA UNION ALL
. . .
select TeamName, 'Activity7' as Activity, Activity4 as Time
from tableA
) t inner join tableB tb on tb.Activity = t.Activity;