I am wondering if it is possible to use result of main select inside subquery. I am giving the below example. It is not very clear query, but the only thing you need to know and I am asking about is how to use table1.id inside subquery. I am getting error "Unknown column 'table1.id' in 'on clause'". Is it even possible to use data from "outer" select inside subquery?
SELECT
(SELECT table2.budget FROM project_objects
INNER JOIN project_objects AS table2 ON table2.project_id=table1.id),
table1.id
FROM project_objects AS ticket
INNER JOIN projects AS table1 ON table1.id=ticket.project_id
GROUP BY table1.id
Thanks a lot!