i have one table
|cp_id|id|value|
|—–|—|—-|
|112 |5 |ok |
|3369 |112|ok |
|10 |8 |ok |
|3368 |10 |ok |
and i am struggling with, if i want information for id ‘5’ (i got only one row)
SELECT * FROM table WHERE id= '5'
but I need to find out the related information as well.
result, which i want:
|cp_id|id|value|
|—-|—|—-|
|112 |5 |ok |
|3369 |112|ok |
I tried:
SELECT *
FROM table
WHERE cp_id = (SELECT cp_id FROM table where id = 5)
UNION
SELECT *
FROM table
WHERE id = 5
but it’s not correct