Pergunta

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
Foi útil?

Solução

try this

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

Outras dicas

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
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top