Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Iterate Months in a select statement
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00562599
Message ID:
00562615
Vues:
17
Steven

Not really a cross-tab since you only have one variable. It would be a cross-tab if you wanted to know number that started for each Dr.

But, anyway, you can do what you want using count()

SELECT
count(datepart(m,@startdatein)=datepart(m,startdate) As Month1
,count(datepart(m,@startdatein)<=datepart(m,startdate) As Month1
....
WHERE startdate > @startdatein

I haven't test this, but it should get you started.

BOb
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform