MySQL correlated subquery in JOIN syntax

后端 未结 5 1842
深忆病人
深忆病人 2020-12-30 01:34

I would like to provide a WHERE condition on an inner query by specifying innertable.id = outertable.id. However, MySQL (5.0.45) reports \"Unknown column \'outertable.id\' i

5条回答
  •  温柔的废话
    2020-12-30 02:10

    I imagine the problem is 'cfv.typeid = t.ticketid' then? My thinking about that would be that, while MySQL supports correlated subqueries, what you're trying to do seems like it could fail in a join because the 'inner' query isn't really 'inside' the rest of the query like it is in a WHERE clause. But it looks like you could just take the where clause out of the subquery and make your join condition on a.typeid = t.ticketid.

提交回复
热议问题