I want to pass parsed_param to nested select. Like this .
select name ,ord.sq,ord.sp ,sandwich_id as parsed_param
from sandwiches , (select sum(quantity) as sq, sum(total_price) as sp
from order_sandwiches
where sandwich_code=parsed_param) as ord
order by parsed_param
Try this