user2102732
user2102732

Reputation: 29

Delphi MySql: Unknown column in where clause

I'm using Delphi to perform a query on MySQL database.

A simple query like:

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

works perfectly via Navicat, but fails using delphi with error message:

"Unknown column field1 in where clause"

Thanks

Upvotes: 0

Views: 647

Answers (1)

whosrdaddy
whosrdaddy

Reputation: 11860

use joins and aliases :

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

Upvotes: 6

Related Questions