MySQL Forums
Forum List  »  Newbie

Re: Help With Advanced Query
Posted by: Peter Brawley
Date: November 14, 2015 11:39AM

> 1 Listing Per Hotel, Per Airport, Per Day

You failed to say on what criterion. Supposing it's minimum price, you could write something like ...

select a.*
from search_results a
join (
  select datecol, airportcol, hotelcol, min(price) as theprice
  from search_results
  where priceperadult ... etc ...
  group by datecol, airportcol, hotelcol
) as b on a.datecol=b.datecol 
       and a.airportcol=b.airportcol 
       and a.hotelcol=b.hotelcol
       and a.price=b.theprice;

substituting correct column names.

Options: ReplyQuote


Subject
Written By
Posted
November 14, 2015 05:36AM
Re: Help With Advanced Query
November 14, 2015 11:39AM
November 14, 2015 11:51AM
November 14, 2015 09:49PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.