【发布时间】:2013-05-14 20:47:26
【问题描述】:
我有以下问题
'''SELECT %(t1)s.*, %(t2)s.id, %(t2)s.street
FROM %(t1)s, %(t2)s
LEFT OUTER JOIN %(t2)s
ON %(t2)s.id = %(t1)s.location_id
''' % { 't1' : 'table1', 't2' : 'table2' }
我曾尝试使用LEFT OUTER JOIN %(t2)s t2alias ON t2alias.id = ...,但无济于事。相反,我得到了1054, "Unknown column。我错过了什么?
谢谢
【问题讨论】:
-
嗯,如果我查看您的查询,我认为
JOIN-ingtable2两次没有意义? -
什么是
%(t1)s?为什么你不能只做table1.*或给FROM table1 alias1, table2 alias1之类的别名?