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 |
|
rajesh.4334
Starting Member
1 Post |
Posted - 2008-06-24 : 13:57:19
|
| The below is a Part of the table structure.offeringid offeringname RequestDatetime------------------------------------------------------10010 Network 6/24/2008 9:05:08 AM10010 Network 6/24/2008 9:05:11 AM10010 Network 6/14/2008 9:05:12 AM10010 Network 6/20/2008 9:05:13 AM10020 Plasma 6/14/2008 9:05:41 AM10020 Plasma 6/24/2008 9:05:45 AM10030 StaffMonitor 6/14/2008 9:06:08 AM10030 StaffMonitor 6/20/2008 9:06:09 AM10030 StaffMonitor 6/24/2008 9:06:10 AM10040 Firmware 6/24/2008 9:06:32 AM10050 Internet 6/22/2008 9:06:56 AMNow, when I am running this below query,select count (offeringid) as "Individual Service Requested", offeringname from RequestTrack where RequestDatetime between '6/1/2008' and '6/25/2008' group by offeringnameI am getting the result like this (result from complete table)...2 Firmware12 Internet7 Network4 Plasma5 StaffMonitorNow, You can see that in the above query the Dates (periods) are hardcoded.But, how can I get the Similar result with the Dynamic variables(StartDate and EndDate) which will be entered from an applications frontend to generate a report)Please provide your inputs in this concernThanks and Regards,Rajesh... |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-06-24 : 14:00:30
|
| Use variables of DATETIME datatypeselect count (offeringid) as [Individual Service Requested], offeringname from RequestTrack where RequestDatetime between @start_date and @end_date group by offeringnameMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|