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
 SQL Server 2005 Forums
 High Availability (2005)
 Dyanamic Query

Author  Topic 

reachmmadhu
Starting Member

12 Posts

Posted - 2009-01-29 : 04:31:02
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.
Go to Top of Page

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 Table
WHERE datefield >=@fromdate
AND datefield< @todate
GROUP BY DATENAME(mm,datefield)


make sure you pass complete date value including day for from and to date
Go to Top of Page

reachmmadhu
Starting Member

12 Posts

Posted - 2009-01-30 : 08:55:58
thank you very much

Madhu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-30 : 10:18:00
welcome
Go to Top of Page
   

- Advertisement -