1
4

2 回答 2

2

那不应该是

SELECT
m.memberID, m.zoneCode, m.state, m.zone, m.countyName,
CONCAT(m.state,'Z',m.zone) as fullZoneCode,
c.state, c.zone, c.countyName
FROM members_zonesToWatch m
LEFT JOIN countyPublicForcastZoneCorrelation c
ON c.zoneCode = CONCAT(m.state, 'Z', m.zone) 
于 2012-07-07T05:05:45.920 回答
2

在对您的案例进行测试后,问题'Z'$db->query

这是因为当您的语句(从调试器看来,引号变为)时,MysqliDB内部使用mysqlimysqli引发了异常。prepare''

相反,请MysqliDB提供rawQuery像您这样的案例。所以使用下面的:

$result = $db->rawQuery('
    SELECT m.memberID, CONCAT(m.state, ? ,m.zone) as fullZoneCode
    FROM members_zonesToWatch m
    LEFT JOIN countyPublicForcastZoneCorrelation c
    ON c.zoneCode = CONCAT(m.state, ? ,m.zone)',
    array('Z','Z'));

参考:PHP-MySQLi-Database-Class / MysqliDb.php

于 2012-07-14T02:00:02.177 回答