Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Iterate Months in a select statement
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00562599
Message ID:
00562615
Views:
16
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform