我有两张不同的桌子
table1 - property
=================
id,name, address, city state, zip
table2 - floorvalue
===================
id, rentmin, rentmax, bedrooms, bathrooms
我需要一个查询来从两个表中获取最低租金值,当前下面的查询获取例如两条记录,其中包含所有值,如属性 id、名称、城市、州,然后是楼层 id、rmin、rmax 等。但我需要如果我获得两个或多个相同 ID 的记录,则为第一个最低租金。
查询我有:
select
p.id,
p.name,
p.address,
p.city,
p.state,
p.zip,
f.id,
f.rmin,
f.rmax,
f.bedrooms,
f.bathrooms
from property as p, floorvalue as f
where p.city = 'losangeles' and p.state = 'ca' and p.id = f.id