我的查询看起来像这样:
SELECT tablea.field,
(
SELECT sum(count) FROM
(
SELECT count(distinct(subtable.regdate)) as count
FROM subtable
where subtable.regid = tableb.regid
GROUP BY subtable.userid
) as a
) as thesum
FROM tablea
LEFT JOIN tableb on tableb.id = tablea.tableaid
GROUP BY tablea.field2
问题是在我的子查询中引用的表“tableb”是未知的,所以我收到错误:“'where 子句'中的未知列'tableb.regid'”
我该如何解决这个问题?
谢谢 !