开发者

MySQL Left join - odd problem

Running mySQL Community Server 5.5.13

Using the following query:

select t1.f1, t2.f1, t2.f2
from t1 left join t2 on (t1.f3 = t2.f3)

If the left join finds no matches in table t2, rather than putting nulls in the values for t2.f1, t2.f2, it is actually putting the column names there.

Any suggestions why this migh开发者_如何学编程t be happening?


Try this:

SELECT `t1`.`f1`, `t2`.`f1`, `t2`.`f2`
FROM `t1`
LEFT JOIN `t2` ON `t1`.`f3` = `t2`.`f3`;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜