Where clause is ambiguous
Where clause is ambiguous
The error message "Column 'languageid' in where clause is ambiguous" appears during a query using the mysql database, this error in where clause is ambiguous is probably caused by the fact that a same column name appears in several tables during multi-Table query, and the table is not specified after the WHERE clause of the query condition.
Or there are two identical column names in the query results, but no table is specified.
In this way, you can avoid the error Column 'your ageid' in where clause is ambiguous by adding a table name before mysql query.
SELECT tablea. id aid table. id bid WHERE tablea. id = tableb. id
SELECT *
FROM tbl_listings
WHERE postcode = 'var1' AND catID = 'var2' AND stateID = 'var3'
Order by listingName ASC
Using the following variables
Name: var1
Default value:-1
Run-time value: $ _ GET ['postcode']
Name: var2
Default value:-1
Run-time value: $ _ GET ['catid']
Name: var3
Default value:-1
Run-time value: $ _ GET ['stateid']
I, however, want to get the category name from the category table using a join so I tried this:
Code:
SELECT *
FROM tbl_listings left join tbl_category ON tbl_listings.catID = tbl_category.catID
WHERE postcode = 'var1' AND catID = 'var2' AND stateID = 'var3'
Order by listingName ASCusing the following variables
Name: var1
Default value:-1
Run-time value: $ _ GET ['postcode']
Name: var2
Default value:-1
Run-time value: $ _ GET ['catid']
Name: var3
Default value:-1
Run-time value: $ _ GET ['stateid']
This gives me an error saying: Column: 'catid' in where clause in ambiguous.
WHERE postcode = 'var1' AND tbl_listings.catID = 'var2'
OR
PHP Code:
WHERE postcode = 'var1' AND tbl_category.catID = 'var2'