Reputation: 21
MEMBERS TABLE:
ID Resident Gender Location
1 Steve M S-55
2 Roger M S-42
3 Martha F R-20
4 Samantha F CC
5 Tom M S-12
I am trying to code an SQL Statement that returns a single numerical value.
Something along the lines of:
SELECT COUNT(Gender)
FROM Members
WHERE GENDER = M
AND Location CONTAINS 'S%'
The AND LOCATION
obviously doesn't really exist in SQL
in that syntax, but I'm hoping to get the count of how many members that are MALE
and reside in a location that has an S in it.
Is this possible?
Upvotes: 1
Views: 75
Reputation: 1981
SELECT COUNT(*) as count
FROM Members
WHERE GENDER = 'M' AND Location LIKE 'S%'
Upvotes: 1
Reputation: 24803
SELECT COUNT(*)
FROM Members
WHERE GENDER = 'M'
AND Location LIKE '%S%'
Upvotes: 2