i have two different tables

table1 - property
=================

id,name, address, city state, zip

table2 - floorvalue
===================

id, rentmin, rentmax, bedrooms, bathrooms

i need a query to fetch first min rent values from the two tables

query i have :

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

Hi,

Try:

SELECT *
FROM `property`
INNER JOIN `floorvalue` ON `property`.`id` = `floorvalue`.`id`
ORDER BY `floorvalue`.`rentmin` ASC
LIMIT 1

R.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.