tags:

views:

27

answers:

0
SELECT rel.*,o.*,sr.*,sq1.*, (SELECT COUNT(*) FROM survey_questions sq
  JOIN survey_answers sa
    ON sa.iQuestionId = sq.iQuestionId WHERE sq.iQuestionId = '50') AS total_scale 
FROM survey_questions  sq1 
  JOIN survey_response sr ON sr.iQuestionId = sq1.iQuestionId
  JOIN observer o ON o.iObserverId = sr.iObserverID
  JOIN relationship rel ON rel.iRelationshipId = o.iRelationshipId
WHERE sq1.iQuestionId = '50'
  AND sq1.eQuestionType = 'ScalePoint'
  AND sr.eResponseBy = 'Observer'

This query gives me 6 data rows when executed in the sql prompt now is there a way that i can get the seventh row as the average of all this six row as the seventh row without using the union