In short, want to left join table to itself, but only rows that have id 1 or 2
Table:
id f1
1 a
1 b
2 a
3 a
expected result
1 2 a a
1 2 b null
does not work:
select t1.id,t2.id, t1.f1,t2.f1
from table t1
left join table t2 on t1.f1 = t2.f1 and t1.id = 1 and t2.id = 2
Any idea ?