试图在查询中使用SOUNDEX,但在mysql中的数据库列中出现错误
问题描述:
Trying to figure out what went wrong, must be a silly syntax.
$objDatabase = QApplication::$Database[1];
$strQuery = 'UPDATE `account` SET `sndx`=SOUNDEX("'.$objAccount->Name.'") WHERE `Id`='.$aid;
$objDbResult = $objDatabase->Query($strQuery);
The error I get is:
MySqli Error: Unknown column 'sndx' in 'field list' Exception Type: QMySqliDatabaseException
There is no sndx column. The intent is to match values in account using SOUNDEX....
答
Well, you've answered your own question. If there is no sndx column, you can't set a value to it which is why the query fails.
Update your table to have an sndx column.