I have a query like this
SELECT a.id AS col1, b.id AS col2, b.title AS col3
FROM tbl1 a
INNER JOIN tbl2 b ON a.tbl2_id=b.id
this query is working properly, now if i make a subquery and pass the value of col2, like this
SELECT a.id AS col1, b.id AS col2, b.title AS col3, (
SELECT a.name
FROM tbl1 a
INNER JOIN tbl2 b ON a.tbl2_id=b.id
WHERE a.id= [value of col2]
)
FROM tbl1 a INNER JOIN tbl2 b ON a.tbl2_id=b.id
how can i achived to pass the value of col2 in subquery? Thanks in advance