我怎样才能比较第一个选择的同一个PlayerID和其他选择的PlayersIds?
select PlayerId ,
sum([RedeemedAmount])
FROM table1
group by PlayerId
order by playerid
select playerid,
sum(RedeemedBonusMoneyGrossWinAmount),
sum(BonusMarketingCostAmount)-sum(RedeemedBonusMoneyGrossWinAmount),
sum(RedeemedBonusCashAmount)
FROM table2
group by PlayerId
order by playerid
table1的结果是
PlayrID REdeemedAmount
-1 0.000000
1136 0.000000
1145 216.000000
1147 368.000000
1148 108.000000
1155 0.000000
table2的结果是
PlayerId value1 value2 RedeemedBonusCashAmount
1136 0.000000 0.000000 0.000000
1145 0.000000 216.000000 216.000000
1147 -180.000000 368.000000 368.000000
1148 50.000000 108.000000 108.000000
1177 0.000000 0.000000 0.000000
1188 0.000000 188.000000 188.000000
1198 0.000000 0.000000 0.000000
答案 0 :(得分:1)
内部联接
select *
from table1 t1
inner join table2 t2
on t1.PlayerId=t2.PlayerId