A Database Error Occurred
Error Number: 1242
Subquery returns more than 1 row
select listings.listing_id, listings.listing_name, listings.listing_uri, listings.is_featured, -- listings.summary, concat(substr(listings.description, 1, 500), '...') summary, listings.bedrooms, listings.bathrooms, listings.location, islands.island_name, islands.island_uri, islands.island_summary, listing_images.image_key, (select rate_amount from listing_rates inner join rate_types on listing_rates.rate_type_id = rate_types.rate_type_id where listing_rates.listing_id = listings.listing_id and listing_rates.bedrooms = listings.bedrooms and listing_rates.bathrooms = listings.bathrooms and listing_rates.end_date > now() and rate_types.type = 'high' order by listing_rates.end_date limit 0, 1) high_rate, (select rate_amount from listing_rates inner join rate_types on listing_rates.rate_type_id = rate_types.rate_type_id where listing_rates.listing_id = listings.listing_id and listing_rates.bedrooms = listings.bedrooms and listing_rates.bathrooms = listings.bathrooms and listing_rates.end_date > now() and rate_types.type = 'low' order by listing_rates.end_date limit 0, 1) low_rate, ( select count(*) from listing_rates inner join rate_types on rate_types.rate_type_id = listing_rates.rate_type_id and rate_types.type = 'high' where listing_id = listings.listing_id and listing_rates.end_date > now() and -- nastiness below is just using the subquery from above to get the high rate listing_rates.rate_amount < (select rate_amount from listing_rates inner join rate_types on listing_rates.rate_type_id = rate_types.rate_type_id where listing_rates.listing_id = listings.listing_id and listing_rates.bedrooms = listings.bedrooms and listing_rates.bathrooms = listings.bathrooms and listing_rates.end_date > now() and rate_types.type = 'high' order by listing_rates.end_date limit 0, 1) ) has_lowerrates, (select attribute_value from listing_attributes inner join attributes on listing_attributes.attribute_id = attributes.attribute_id and attributes.attribute_name = 'Pool' where listing_attributes.listing_id = listings.listing_id) has_pool, (select attribute_value from listing_attributes inner join attributes on listing_attributes.attribute_id = attributes.attribute_id and attributes.attribute_name = 'Beachfront' where listing_attributes.listing_id = listings.listing_id) has_beach, (select attribute_value from listing_attributes inner join attributes on listing_attributes.attribute_id = attributes.attribute_id and attributes.attribute_name = 'Internet' where listing_attributes.listing_id = listings.listing_id) has_internet from listings inner join islands on listings.island_id = islands.island_id inner join listing_images on listings.listing_id = listing_images.listing_id and listing_images.is_primary = 1 inner join status_types on listings.status_type_id = status_types.status_type_id and status_types.status_type = 'Published' where islands.island_uri = 'st-croix' order by listings.is_featured desc limit 0, 7