Page 1 of 1

clause is ambiguous

Posted: Wed Aug 23, 2006 2:17 pm
by psurrena
For the following query

Code: Select all

...connect to db

$a_id = $_GET['a_id'];
			
$query   = "SELECT * FROM article INNER JOIN image ON (image.a_id=article.a_id) WHERE a_id='$a_id'";
	
...rest of code
I get the error: "Column: 'a_id' in where clause is ambiguous"

What is this saying?

Posted: Wed Aug 23, 2006 3:39 pm
by volka
use WHERE image.a_id
mysql doesn't analyze the query in such depth to realize image.a_id=article.a_id makes it irrelevante which a_id to use in the WHERE clause.

Posted: Wed Aug 23, 2006 4:26 pm
by psurrena
Great, Thanks!