这是查询,我无法找到此解决方案之前找到了一个别名 near" req_id" 。为什么会出现这种错误?请查看它。
select property.property_type,
property.agent_id,
agents_profile.user_photo,
agents_profile.phone_no,
agents_profile.first_name,
agents_profile.family_name,
agents_profile.mob_verify_flag,
property.location,
property.longitude,
property.latitude,
property.images,
property.floor_plan_image,
property.epc_image,
property.available_start_date,
property.available_end_date,
property.monthly_rent,
property.deposit,
property.bedrooms,
property.bathrooms,
property.furnished_type,
property.is_secure_access,
property.is_above_street_level,
property.is_parking,
property.is_parking_covered,
property.total_parking,
property.is_parking_secure,
property.is_garden,
property.accept_social_housing_tenant,
property.flag,
property.isWifiAvailable,
property.isPetsPresent,
property.isSmoking,
property.isStudent
(SELECT id
FROM `request_property`
WHERE tenant_id=0 AND agent_id=property.agent_id AND property_id=294
LIMIT 1) as req_id
FROM property
INNER JOIN agents_profile ON property.agent_id=agents_profile.agent_id
WHERE property.id=294
LIMIT 0, 25`
答案 0 :(得分:1)
没有逗号将子查询字段定义与字段列表分开:
select property.property_type,
...
property.isStudent, <---this comma was missing
(SELECT id
FROM `request_property`
WHERE tenant_id=0 AND agent_id=property.agent_id AND property_id=294
LIMIT 1) as req_id
FROM property
INNER JOIN agents_profile ON property.agent_id=agents_profile.agent_id
WHERE property.id=294
LIMIT 0, 25`
答案 1 :(得分:1)
您在isStudent
之后错过了逗号:
// more stuff above
property.isSmoking,
property.isStudent, -- HERE
(SELECT id
FROM `request_property`
WHERE tenant_id=0 AND agent_id=property.agent_id AND property_id=294
LIMIT 1) as req_id
FROM property