Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
If a user enters fromdate(Feb/07) and Todate(JULY) then it has to fetch the data in between the given date and display monthly records(FEB,MARCH,APRIL,MAY,JUNE,JULY)Madhu
sodeep
Master Smack Fu Yak Hacker
7174 Posts
Posted - 2009-01-29 : 10:26:42
Please post it in T-SQL topic with sample data and expected output.
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2009-01-29 : 11:32:43
just use
SELECT DATENAME(mm,datefield),SUM(yourfield),...FROm TableWHERE datefield >=@fromdateAND datefield< @todateGROUP BY DATENAME(mm,datefield)
make sure you pass complete date value including day for from and to date