MySQL nesting optimization -
i've been trying solve 2 hours now, , can't success
attached below response query:
select login, sum(gain) weekly_gain gt_history is_closed = 1 , (cmd = 0 or cmd = 1) group week(close_time), login
now, is, make average
of values, group by
login.
ideas?
simply use query have sub-query.
select login, avg(weekly_gain) (select login, sum(gain) weekly_gain gt_history is_closed = 1 , (cmd = 0 or cmd = 1) group week(close_time), login) group login