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.
| Author |
Topic |
|
craigmacca
Posting Yak Master
142 Posts |
Posted - 2008-12-05 : 04:23:26
|
| Hi i need a stored proc to do the follwingselect count(id) as rcount, DATENAME(MONTH,RDate)as GMonthFROM Records_tableWHERE RCODE <> 'IN'GROUP BY month(RDate)but its not quite workingthis is for a graph to show the count by month.. |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2008-12-05 : 04:55:06
|
| whats not working ? Is there an error when you run the query ? Or, You don't have the funtionality going ..Why stored proc ?? You have posted too little .. Elaborate, post sample data etc etc |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-12-05 : 05:58:35
|
| select count(id) as rcount, DATENAME(MONTH,RDate)as GMonthFROM Records_tableWHERE RCODE <> 'IN'GROUP BY DATENAME(MONTH,RDate)MadhivananFailing to plan is Planning to fail |
 |
|
|
craigmacca
Posting Yak Master
142 Posts |
Posted - 2008-12-05 : 06:30:50
|
| ok the results i am getting are incorrecti have lots of month names, i have tried distinct by stull get simlar resultswhat i need isJan 07 556feb 07 334march 07 2323Jan 08 454545but i also need to group by the year aswell |
 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2008-12-05 : 06:43:20
|
| Post Sample Data and Expected Output. That way we are not stabbing in the dark.You've posted output but no dataset to work from.Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-12-05 : 07:35:07
|
| select count(id) as rcount, DATENAME(MONTH,RDate)as GMonthl,DATEPART(YEAR,RDate)as GYearFROM Records_tableWHERE RCODE <> 'IN'GROUP BY DATENAME(MONTH,RDate),DATEPART(YEAR,RDate)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|