Previous Topic: Example 1Next Topic: Example 3


Example 2

Show the job code, maximum salary and minimum salary for each group of rows of the table TEMPL with the same job code, but only for groups with more than one row and with a maximum salary less than $50,000.

      SELECT JOBCODE, MAX(SALARY), MIN(SALARY)
      FROM CA.TEMPL
      GROUP BY JOBCODE
      HAVING COUNT(*) > 1 AND MAX(SALARY) < 50000