【发布时间】:2019-02-28 14:20:09
【问题描述】:
我的查询中出现此错误,您知道如何将sdate 放在 2 层子查询中吗?
select
at.startDate as sdate, at.dau as DAU,
(
select count(distinct d.uid) from
(select ses.uid from dsession as ses where ses.startDate = sdate group by ses.uid
union all
select res.uid from rsession as res where res.startDate = sdate group by res.uid) as te
) as MAU, (SELECT DAU/MAU) as AVG
from
attendance as at
如果我单独查询子查询,它可以工作,但是当我将它合并到主查询时,sdate 变得未知。有什么想法吗?
我尝试将where 上的sdate 替换为at.startDate,但仍然得到未知的at.startDate 列。
【问题讨论】:
标签: mysql sql select union-all