Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Month

Author  Topic 

nicci113
Starting Member

11 Posts

Posted - 2012-10-24 : 05:55:31
SELECT cvw_FlatView_Cases.NoticeNumber, cvw_FlatView_Cases.IssueMonthYear
FROM SiDem_Reports.dbo.cvw_FlatView_Cases cvw_FlatView_Cases
WHERE (cvw_FlatView_Cases.IssueDate>={ts '2012-04-01 00:00:00'} And cvw_FlatView_Cases.IssueDate<=getdate())
GROUP BY cvw_FlatView_Cases.NoticeNumber, cvw_FlatView_Cases.IssueMonthYear

Result:

HQ03037830 May-2012
HQ03201140 May-2012
HQ03147282 May-2012
HQ03039654 May-2012
HQ03201151 May-2012


Hey Can you please guide, the above is my SQL and below is the result I am getting. I only want to count the number of HQ% that comes in a month and dont want to see the actual number any help?

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2012-10-24 : 05:59:31
maybe

SELECT count(*), cvw_FlatView_Cases.IssueMonthYear
FROM SiDem_Reports.dbo.cvw_FlatView_Cases cvw_FlatView_Cases
WHERE (cvw_FlatView_Cases.IssueDate>={ts '2012-04-01 00:00:00'} And cvw_FlatView_Cases.IssueDate<=getdate())
GROUP BY cvw_FlatView_Cases.IssueMonthYear

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

nicci113
Starting Member

11 Posts

Posted - 2012-10-24 : 06:06:52
it does make me numpty in here, tried this but didnt worked..hate writing sql in excel. Thanks mate much appreciate
Go to Top of Page
   

- Advertisement -