SELECT t1.* FROM tbl t1
WHERE t1.col1 = 'text1'
AND EXISTS(SELECT 'x' FROM tbl t2 WHERE (t2.col2 = t1.col1 or t2.col1 = t1.col2) and t2.id <> t1.id)
select what you need from table1 as t1
inner join table1 as t2 ON (t1.col1 = t2.col2 AND t1.col2 = t2.col1)
where t1.col1 = 'text'
Select DISTINCT t1.* from table as t1
join table as t2 on t1.col1 = t2.col2 and t1.col2 = t2.col1 and t1.col1="text1"