我使用以下查询加入三个表
select a*,c.* from table1 a join table2 b on a.col1 = b.col1 join table3 c on c.col2 = a.col2 where a.col3 = 1 and a.col2 = 1
我越来越不。然后我需要行,所以我也使用group by来过滤结果,但我想要在最后插入的行,所以我尝试了这个
select t1.* from (select a*,c.* from table1 a join table2 b on a.col1 = b.col1 join table3 c on c.col2 = a.col2 where a.col3 = 1 and a.col2 = 1) t1 left join (select a*,c.* from table1 a join table2 b on a.col1 = b.col1 join table3 c on c.col2 = a.col2 where a.col3 = 1 and a.col2 = 1) t2 on (t1.col1 = t2.col1 and t1.rowid<t2.rowid)
它给了我错误
1060 - 重复列名称col2
请帮我解决这个问题。