In SQL Microsoft Mgmt Studio:
This is my query, which works:
SELECT peopleid AS "peopleid", hiredate AS "hiredate",
COALESCE (CAST(termdate AS CHAR(12)), 'Current Employee') AS
"Current"
FROM workers
WHERE hiredate >= '2011-01-01' AND hiredate <=
'2011-12-31'
ORDER BY termdate;
This is the end result:
I need to sort this query so that only the "Current Employee" prints
out. The COALESCE function replaces the NULLS with 'Current
Employee', which is what I want, but how do I get only the 'Current
Employee' to print out? I've tried different ways of WHERE
termdate is... so many things, but I think the datatype is
fighting me.
peopleid
hiredate
Current
1003
2011-12-10
Current Employee
1007
2011-01-25
Current Employee
1021
2011-11-04
Current Employee
1035
2011-05-05
2013-08-06