SELECT `p`.`id`, `p`.`propertyname`, `p`.`location`, `p`.`a_unit`, `p`.`t_unit`, pgi.img_name
FROM `properties` p,(select gallery_id from property_addom as pa
where p.id=pa.p_id) as a join propert_gallery_images as pgi ON a.gallery_id=pgi.pg_id
当我执行它时会显示错误
#1054
- 未知栏' p.id'在' where子句'和属性表包含id coloumn
答案 0 :(得分:0)
不确定你真正想要的是什么。 也许更像这样的东西?
SELECT
`p`.`id`,
`p`.`propertyname`,
`p`.`location`,
`p`.`a_unit`,
`p`.`t_unit`,
pgi.img_name,
a.gallery_id,
FROM `propertyies` p
left join property_addom pa on pa.id=p.id
left join propert_gallery_images pgi on p.gallery_id=pgi.pg_id