Delphi MySql:where子句中的未知列

时间:2014-04-10 07:15:31

标签: mysql delphi

我使用Delphi对MySQL数据库执行查询。

一个简单的查询,如:

select * from table1, table2 
where table1.field1 = table2.field1

通过Navicat完美运行,但无法使用带有错误消息的delphi:

" where子句"

中的未知列field1

由于

1 个答案:

答案 0 :(得分:6)

使用连接和别名:

SELECT t1.*, t2.* 
 FROM table1 t1
  INNER JOIN table t2 ON t1.field1 = t2.field1