MySQL Forums
Forum List  »  General

Re: Nested GroupBy or for each
Posted by: Peter Brawley
Date: October 14, 2018 09:49AM

Is this what you mean?

select measurement_campaign, sensor, if( n<4, -1, mean ) as mean
from (
  select measurement_campaign, sensor, count(*) as n, avg(measurement_result) as mean
  from tbl
  group by measurement_campaign, sensor
) means;

Options: ReplyQuote


Subject
Written By
Posted
October 14, 2018 02:36AM
Re: Nested GroupBy or for each
October 14, 2018 09:49AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.