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
Était-ce utile?

La solution

try this

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

Autres conseils

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
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top