I have a query that return employees:
Name Form
Bob abc
Bob gfd
Bob fgf
John abc
Gavin abc
Jessie ala
Jessie asf
How would I say if abc exists for the employee then result = yes and if abc doesnt exist then no?
What I would want to see is this:
Name Result
Bob Yes
John Yes
Gavin Yes
Jessie No
SQL Server 2000+, use:
The MAX portion will return NULL if none of the form values match “abc”, which the COALESCE catches to return “No”.