[Wolves] mysql select help

Mark Rogers mark at quarella.co.uk
Tue Mar 13 11:24:16 UTC 2012


On 13/03/12 01:52, Chris Ellis wrote:
> You can also use an aggregate function in your subquery rather than a order 
> and limit, this should be more efficient: SELECT * FROM phonelist WHERE 
> trydate = ( SELECT MIN( trydate ) FROM phonelist WHERE trydate > DATE(NOW()) ) 

Good point; it may well be that MySQL will optimise the query to achieve the 
same results but using MIN makes more sense than order and limit. Also, making 
sure that trydate is indexed will make a huge difference.

-- 
Mark Rogers // More Solutions Ltd (Peterborough Office) // 0844 251 1450
Registered in England (0456 0902) 21 Drakes Mews, Milton Keynes, MK8 0ER




More information about the Wolves mailing list