Query to find certain data

  • Hello i stumbled upon task to do write query that will count all employees from employees table but also will count employees hired (hire_date is a column name) in given years 1995 and 1996.

    So as a result i should get:

    Column 1 ( all employees) | Column 2 ( those hired in 1995 ) | column 3 (those hired in 1996)

    -----------------------------------------------------------------------------------------

    Value 1 Value 2 Value 3

    Any suggestions how to get it?

  • as a guide

    SELECT COUNT(employee) AS All_cnt,

    sum(case when hiredate = '1995' then 1 else 0 end) as HY_1995 ,

    sum(case when hiredate = '1996' then 1 else 0 end) as HY_1996

    FROM employees

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • Thank you!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply