List:General Discussion« Previous MessageNext Message »
From:jkraai Date:March 26 1999 3:24am
Subject:Re: Problem with order by
View as plain text  
If you're truly looking for the cheapest, try

select 
	startdate, 
	enddate, 
	boarding, 
	price, 
	hotelname, 
	hotelresidence, 
	stars, 
	hotelcode, 
	time 
from 
	table 
order by 
	price
limit
	1

But it looks like you want something other than 
that from your query with the group by clause.

--jim

Thomas Booms EDV wrote:
> 
> Hello,
> 
> I have a Database with some travels (about 1,500,000 ).
> The table looks so:
> 
> organizer text,
> startpoint text,
> destination text,
> startdate date,
> enddate date,
> hotelcode text,
> placingcode text,
> boarding text,
> price double,
> hotelname text,
> hotelresidence text,
> stars text,
> time int,
> journeytype text,
> persons int
> 
> Now I want to compare all Providers and get the cheapest.
> 
> Here's the query:
> 
> select distinct startdate, enddate, boarding, min(price), hotelname,
> hotelresidence, stars, hotelcode, time from table group by startdate,
> enddate, hotelname, hotelresidence order by price
> 
> The result is not fully sorted by the price !
> It looks like some groups which are sorted and not the whole list is
> sorted.
> 
> Am I wrong with the query or is it a bug in MySQL ?
> 
> Yours Thomas Booms
Thread
Problem with order byThomas Booms EDV25 Mar
  • Re: Problem with order byjkraai26 Mar