主表与子表的其中一条left join
select * from fathertable a
LEFT JOIN childtable d on d.HouseID = a.HouseID and d.MoveInFlag=0 and d.id=(select max(id) from childtable where houseid=a.houseid)
不能把后面的子句写在where中
select * from fathertable a
LEFT JOIN childtable d on d.HouseID = a.HouseID and d.MoveInFlag=0 and d.id=(select max(id) from childtable where houseid=a.houseid)
不能把后面的子句写在where中