Using subselect to accomplish LEFT JOIN

Posted by Andre on Stack Overflow See other posts from Stack Overflow or by Andre
Published on 2010-03-17T23:36:49Z Indexed on 2010/03/17 23:41 UTC
Read the original article Hit count: 297

Is is possible to accomplish the equivalent of a LEFT JOIN with subselect where multiple columns are required. Here's what I mean.

SELECT m.*, (SELECT * FROM model WHERE id = m.id LIMIT 1) AS models FROM make m

As it stands now doing this gives me a 'Operand should contain 1 column(s)' error.

Yes I know this is possible with LEFT JOIN, but I was told it was possible with subselect to I'm curious as to how it's done.

© Stack Overflow or respective owner

Related posts about subselect

Related posts about subquery