From: Jorgen Loland Date: November 25 2010 12:51pm Subject: Re: bzr commit into mysql-next-mr-bugfixing branch (tor.didriksen:3236) WL#1393 List-Archive: http://lists.mysql.com/commits/125024 Message-Id: <4CEE5BC9.9080004@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit On 11/24/2010 04:36 PM, Tor Didriksen wrote: > On 2010-11-19 12:59, Øystein Grøvlen wrote: >> > +################ >> > +## Test with subqueries >> > +SELECT d1.* FROM t1 >> > +LEFT JOIN (SELECT * FROM t1 LIMIT 30) d1 on t1.f1=d1.f1 >> > +ORDER BY d1.f2 DESC LIMIT 30; >> >> I do not think the result of the above query is well defined since the >> contents of the derived table, d1, is not explicitly ordered. > > ??? Without ordering, "select * from t1 limit 30" will return the first 30 records it encounters, but the order depends on the access method. You then left join these 30 "random" records with t1. A different access method for t1 in the subquery may therefore change the result. -- Jørgen Løland | Senior Software Engineer | +47 73842138 Oracle MySQL Trondheim, Norway