Please could someone point me in the right direction. I am pulling data into graphs from a table and use:
SELECT
(CASE
WHEN count (worktype) > 4
THEN worktype
END) as 'worktype',
(CASE
WHEN count (worktype) > 4
THEN count(*)
END) as 'cnt'
from table1
group by worktype
This gives the desired results but also includes the NULL values as well:
Driver 57
NULL NULL
Painter 6
Carpenter 17
Nurse 73
NULL NULL
How can I get rid of the NULLS that represent worktypes with less than 4 employees? Or, even better, how do I catch the values that are less than 4 and add them to show 'OTHER JOB' with the sum of the values < 4?
Any help will be greatly appeciated.
Thanks
SELECT
(CASE
WHEN count (worktype) > 4
THEN worktype
END) as 'worktype',
(CASE
WHEN count (worktype) > 4
THEN count(*)
END) as 'cnt'
from table1
group by worktype
This gives the desired results but also includes the NULL values as well:
Driver 57
NULL NULL
Painter 6
Carpenter 17
Nurse 73
NULL NULL
How can I get rid of the NULLS that represent worktypes with less than 4 employees? Or, even better, how do I catch the values that are less than 4 and add them to show 'OTHER JOB' with the sum of the values < 4?
Any help will be greatly appeciated.
Thanks