Count the number of yazvennikov received in the current year. Here is my option

SELECT count(diagnoz) FROM pacienti WHERE diagnoz='yazva' AND data_postupleniya >= DATE() 

but it gives me the number of all the ulcers, and not just those that arrived this year, tell me how to do it correctly

  • in what format do you have the date stored? - Gorets 2:57

1 answer 1

If we talk about MSSQL:

 SELECT count(diagnoz) FROM pacienti WHERE diagnoz='yazva' AND YEAR(data_postupleniya) = YEAR(GETDATE())