I have following table1
id name
1 A
3 B
and table2
id label value
1 a 10
1 b 11
1 c 12
2 a 13
2 b 14
2 c 15
3 a 16
3 b 17
3 c 18
My desired result is following.I'd like to join table1 and table2 in label=a and b
I guess I must join twice in each condition..
id name a b
1 A 10 11
3 B 16 17
I tried following one, but I get only result in label = a
select *
from table1
left join table2 using(id)
where label in ('a')
Are there any good way to achieve this? I guess we need transpose
Thanks