You can do this by performing a join
on the two values. Note that you are returning more than one row, so you can't do this as nested subqueries in the select
clause:
select x.box_value as x, y.box_value as y
from (SELECT box_value
FROM my_table
WHERE box_id = 250
) x cross join
(SELECT box_value
FROM my_table
WHERE box_value = 42 AND box_id = 250
) y;
I do want to note that the y
value is constant, so you could also do:
select x.box_value as x, 42 as y
from (SELECT box_value
FROM my_table
WHERE box_id = 250
) x