将2个无关联的select结果一同输出

select menu_title,

totalDays,

totalCooked

from (select menu_title,

count(*) as cookedTimes,

1 as idx

from cookrecord

WHERE uid = 22

GROUP BY menu_title

order by cookedTimes DESC limit 1) a

left join

(select

count(*)as totalDays,

sum(num) as totalCooked,

1 as idx

from

(select id,

count(*) as num

from cookrecord

where uid = 22

GROUP BY day(gmtCreate)

order by num) t1)t2

on a.idx = t2.idx

你可能感兴趣的:(将2个无关联的select结果一同输出)