Question

Hi I am trying to do the following query. Basically im trying to count all musicians that exist that are born in 1990.

SELECT COUNT(MusicianID), 
COUNT(DISTINCT CASE WHEN year(DateOfBirth)=1990)
FROM Musician
Was it helpful?

Solution

try this

 SELECT COUNT(MusicianID) As allmusicians
 FROM Musician
 WHERE year(DateOfBirth) = 1990

OTHER TIPS

SELECT COUNT(MusicianID)
FROM Musician
WHERE YEAR(DateOfBirth)=1990
Select count(musicianid)
from musician
Where year(date of birth) = 1990

This will work:

SELECT COUNT(MusicianID)
FROM Musician
WHERE YEAR(DateOfBirth)=1990
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top