List:General Discussion« Previous MessageNext Message »
From:Jigal van Hemert Date:December 29 2004 9:16am
Subject:Re: MySQL GROUP BY Challenging problem
View as plain text  
From: "pravin" <pravinn@stripped>
> SRNO EMP_ID DATETIME QUES1 QUES2 QUES3 QUES4 QUES5 QUES6 QUES7 QUES8
> I now want to show a report from this table.This report will be group by
> So the main problem is for calculating average of QUES3 for EMP_ID=10.
> This average is calculating without considering NA records. So for QUES3
> answers are 4,NA,2 so the average will be 6/2 and not 6/3.

The easiest solution to this problem altogether is to modify the database a
little:
- modify QUES1-8 so they can contain NULL-values
- replace "NA" with NULL

If you do this the AVG() function will work correctly.

Regards, Jigal.

Thread
MySQL GROUP BY Challenging problempravin29 Dec
  • Re: MySQL GROUP BY Challenging problemJigal van Hemert29 Dec