level 2
先把s取出来,取a列满足条件的 union all b列满足条件的 去重,再取他们的值 一样union all
2021年01月28日 00点01分
2
level 1
用case when 或者if
当 from-user=a 则给到 value
➕
当to-user=a则给到value as a
2022年03月31日 06点03分
7
level 1
select to_user a ,sum(value) b from where from_user = 'a' group by to_user
union all
select from_user a ,sum(value) b from where to_user = 'a' group by from_user ;
外面再套个分组求和
2022年05月09日 10点05分
10