SELECT b_items_p_id FROM public.box WHERE b_id =1
{1,3,5}
Now on each of these value, i.e., 1, 3 and 5 I want to run another select query:
select p_desc from public.products where p_id = 1
Advertisement
Answer
You can join box
and products
using the any()
operator, like so:
select p_desc from public.box b inner join public.products p on p.p_id = any(b.b_items_p_id) where b.b_id =1