Select f1.price,f1.to,f1.date
from flight f1
where f1.price=
(
Select min(f2.price)
from flight f2
where f2.from='A' and f2.to=f1.to
group by f2.to
)
and f1.from='A'
order by f1.price ASC,f1.date ASC
Select f1.price,f1.to,f1.date
from flight f1
where Exists
(
Select min(f2.price)
from flight f2
where f2.from='A' and f2.to=f1.to
group by f2.to
having min(f2.price)=f1.price
)
and f1.from='A'
order by f1.price ASC,f1.date ASC作者: start2004 时间: 2009-10-21 14:11
主要问如何提高速度作者: kider 时间: 2009-10-21 17:43
试试explain分析一下作者: edwin_chen 时间: 2009-10-22 10:19
能否给你的相关表结构(包括索引)作者: start2004 时间: 2009-11-12 10:58
问题已经解决,呵呵,忘记来结贴子了作者: xhw1982 时间: 2009-11-15 21:33
select * from flight where from = 'A' group by to having min(price)