In other words something like properties[0]["prices"] = array prices - same other 2 (discounts, availability)

IN A RENTAL PROPERTIES SITE I WANT TO GET AS A RESULT SET for each property sub-arrays
of prices, discounts, availability(when fully booked) (many periods each)

in other words something like properties[0][“prices”] = array prices - same other 2 (discounts, availability) but in each property appear only once[in a var_dump like is now THE SAME property appears many times and prices, discounts, availability are Not arrays ONE only entry per appearance of same property]… what have to use?

$sql = "SELECT p.*, d.*, a.* FROM properties as p  
		 
				 LEFT OUTER JOIN prices as c
				 
				 ON c.Property_ID = p.Property_ID 
				   
				 LEFT OUTER JOIN discounts as d 
				 
				 ON d.Property_ID = p.Property_ID
				   
				 LEFT OUTER JOIN availability as a 
				 
				 ON a.Property_ID = p.Property_ID
				 
				 ";

I have to use GROUP BY…?

my advice is to use three separate queries

one will be this…?

yes… and only one of the three will need to pull from the properties table, the other two can avoid the join

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.