There is an ambiguous where clause for column 'status'
P粉127901279
P粉127901279 2024-02-25 17:41:22
0
2
382

cursor.execute(
"SELECT * FROM `xplt_cases` LEFT JOIN `dgn_cases` ON dgn_cases.rid = xplt_cases.rid WHERE `status`=%(checker)s",
{
  'checker': status
})

I'm new to MySQL and I'm trying to join two tables together to get results, but I get an error message: The column status in the where clause is ambiguous.

"status" is my function parameter.

P粉127901279
P粉127901279

reply all(2)
P粉066224086

Hmm, it looks like both of your tables have a status column. Try prefixing it with the table name (alias):

SELECT * FROM `xplt_cases` x LEFT JOIN `dgn_cases` ON ​​dgn_cases.rid = xplt_cases.rid
WHERE x.`status`=%(checker)s
P粉850680329

ErrorColumn 'status' in where clause is ambiguous means that the 2 tables you joined in the query have a column named status, which is Why Mysql tells you that column status is ambiguous

You can solve this problem by indicating which status column in the table to use in the query. Example;

xplt_cases.`status`=%(checker)s"

or

dgn_cases.`status`=%(checker)s"
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!