MySQL Query using Avg Ignoring Certain Values

In this case we want to get the average of values but we also want to ignore certain values, say if when the deviceType column is greater than 0 and not a negative number. The mysql engine will ignore null values so we can accomplish this using a case statement or MySQLs build in if function

Leave a Reply

Your email address will not be published. Required fields are marked *