当我在以下子查询中包含 2 条注释掉的行时,我的 Sybase 12.5 ASE 服务器似乎需要很长时间才能获得任何结果。没有这 2 行,查询运行正常。那个分组有什么问题?
select days_played.day_played, count(distinct days_played.user_id) as OLD_users
from days_played inner join days_received
on days_played.day_played = days_received.day_received
and days_played.user_id = days_received.user_id
where days_received.min_bulk_MT > days_played.min_MO
and days_played.user_id in
(select sgia.user_id
from days_played as sgia
where sgia.day_played < days_played.day_played
--group by sgia.user_id
--having sum(sgia.B_first_msg) = 0
)
group by days_played.day_played