I have a table that looks like this
years type value x y
1 b 3.74637 false true
1 b -0.52816 true false
1 mon1 0 true false
1 mon1 0 false true
1 mon10 0.00413 true false
1 mon10 0.00137 false true
I want the table to look like
years type x y
1 b 3.74637 -0.52816
1 mon1 0 0
1 mon10 0.00413 0.00137
therefore I create a request where I join the table on itself
SELECT
i.years,
i.type,
i.value as b,
j.value as m
from abc as i
inner join abc as j on i.type = j.type AND i.years = j.years
WHERE i.type = j.type AND i.m = j.b
now I get
years type x y
1 b 3.74637 -0.52816
1 b -0.52816 3.74637
1 mon1 0 0
1 mon1 0 0
1 mon10 0.00413 0.00137
1 mon10 0.00137 0.00413
how do I get rid of the doublets where the x value of a line is equal to the y of the next line