把查询到结果合并放在一行 JOIN非union

select one.max,one.min,one.low sts,c.high ens,one.time from (

        select a.max max,a.min min,b.low low,a.time time,a.aid aid from

        (select max(price) max,min(price) min,time time,id aid from on_jiaoyi_into where sid=".$id."
        group by DATE_FORMAT(`time`,'%Y-%m-%d') ) a LEFT JOIN

        (select price low,id bid from on_jiaoyi_into where sid=".$id."
        group by DATE_FORMAT(`time`,'%Y-%m-%d')  
        order by time ) b on a.aid=b.bid 

        ) one LEFT JOIN

        (select price high,id cid from on_jiaoyi_into where sid=".$id."
        group by DATE_FORMAT(`time`,'%Y-%m-%d')  
        order by time desc) c on one.aid=c.cid 

 

posted @ 2016-01-08 21:49  fleam  阅读(507)  评论(0编辑  收藏  举报