我正在使用以下 MYSQL 语句,但出现错误:'on 子句中的'ErrorUnknown column'property.id'
我四处搜索,我认为这与 JOIN 和 Mysql 5 有关?这是有道理的,因为以前的代码可以正常工作,因此 mysql 更新可能会破坏它
如何更改我的声明以阻止错误发生?
SELECT property.id,
Concat(IF (name = '', '', Concat(name, '<br />')),
IF (address = '', '', Concat(address, '<br />')), IF (city = '', '',
Concat(city, '<br />'))
, IF (
postcode = '', '', Concat(postcode, ', ')), property_region.region) AS
name,
property_type.type,
short_description,
property_tenure.tenure,
Format(sell_price, 0) AS
sell_price,
Format(rent_price, 0) AS
rent_price,
area,
CASE property.tenure
WHEN 1 THEN ''
WHEN 2 THEN 'display:none'
WHEN 3 THEN ''
end AS
sell_display,
CASE property.tenure
WHEN 1 THEN 'display:none'
WHEN 2 THEN ''
WHEN 3 THEN ''
end AS
rent_display,
IF (thumb_image_name = '', 'no_image.gif', thumb_image_name) AS
thumb_image_name,
IF (bookmarks.property_id, 'checked=\"checked\"', '') AS
bookmark_checked
FROM property,
property_tenure,
property_region,
property_type
LEFT JOIN bookmarks
ON property.id = bookmarks.property_id
AND bookmarks.user_id = $user_id
WHERE property.featured = 1
AND property.active = 1
AND property.region = property_region.id
AND property.tenure = property_tenure.id
AND property.type = property_type.id
ORDER BY timestamp