子查询中的Order By对外部查询排序的影响

时间:2018-04-23 11:22:35

标签: mysql

我有一个查询子查询从其他表中获取数据。子查询中的order by子句是否也以相同的顺序对外部查询的记录进行排序??

查询的格式为:

select p.email email, max(p.firstname) firstname,max(p.lastname) lastname  
from abc p, xyz c 
where p.companyid=c.companyid 
and  c.company!=''  
and locationid in (  
                   select locationid  
                   from mno tr   
                   where 1=1 
                   AND tr.inc in (7,8,9)  
                   AND tr.topic in( 'Callidus Cloud')  
                   AND tr.inc IS NOT NULL  
                   order by inc desc 
                  ) 
AND c.crange IN ('100-249','250-499','500-999','1000-4999'
                  ,'5000-9999','50000-100000','>100000') 
group by p.email limit 7 offset 0

1 个答案:

答案 0 :(得分:0)

子查询中发生的情况仍然存在于子查询中。它只返回您要求的值。