SHARE
TWEET

Untitled

a guest Sep 13th, 2017 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT DISTINCT (SELECT NAME
  2.                  FROM   users.company
  3.                  WHERE  companyid = EMAR.ratedcompanyid
  4.                         AND eventid = 8)                      AS [COMPANY_NAME],
  5.                 (SELECT TOP 1 Round(Avg(Cast(answervalue AS FLOAT))
  6.                                       OVER(), 2) AS
  7.                               [AVERAGE_GRADE_FOR_SINGLE_MEETINGS]
  8.                  FROM   events.eventmeetingratinganswer
  9.                  WHERE  staticratingquestionid = 1
  10.                         AND answervalue != 'none'
  11.                         AND eventmeetingagendaratingid IN
  12.                             (SELECT eventmeetingagendaratingid
  13.                              FROM   events.eventmeetingagendarating
  14.                              WHERE  eventid = 8
  15.                                     AND ratedcompanyid =
  16.                                         EMAR.ratedcompanyid)) AS
  17.                 [SINGLE_MEETINGS_OVERAL_RATING]
  18. FROM   events.eventmeetingratinganswer EMRA
  19.        INNER JOIN events.eventmeetingagendarating EMAR
  20.                ON EMRA.eventmeetingagendaratingid =
  21.                   EMAR.eventmeetingagendaratingid
  22. WHERE  EMRA.staticratingquestionid = 1
  23.        AND EMRA.answervalue != 'none'
  24.        AND EMAR.eventid = 8
  25. ORDER  BY [single_meetings_overal_rating] DESC,
  26.           [company_name] ASC
RAW Paste Data
Top