Link to home
Create AccountLog in
Avatar of ralphp1355
ralphp1355Flag for United States of America

asked on

SQL - Sql Server - Using CASE statement - how to filter results

Using SQL CASE with Search criteria but all lines coming back - how do I limit to just the rows matching the case statement?

EX:
select name, 'SEX' =
CASE
when ('sex = m' then 'Male')
END
just want to return all the Male and not have an empty row for females?!?!?!?
ASKER CERTIFIED SOLUTION
Avatar of joshbula
joshbula

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Ephraim Wangoya

select name, 'Male' [SEX]
from table
where sex = 'm'