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 |
|
sanjay_jadam
Yak Posting Veteran
53 Posts |
Posted - 2006-01-23 : 02:35:50
|
| Hi all,I have a table I which these fields are presentEnrollmentIdPersonIDEnrollmentDateProductIDI have to find the count of person who enrolled for a particular product from 3 month ago, means I have to find person who enrolled in past three month.User will enter only Year and I have to show data from past year to current year.Means if user will enter 2005 then I have to show data from 2004 to 2005Please help me |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-01-23 : 02:57:15
|
| >> find the count of person who enrolled for a particular productyou can use select count(*) with group by PersonID>> for a particular product from 3 month agouse dateadd(month, -3, getdate()) to calc 3 mths ago date. Compare it with your column>> User will enter only Year and I have to show data from past year to current year.>> Means if user will enter 2005 then I have to show data from 2004 to 2005Is your requirement 3 months ago or past year to current year ? ? ?-----------------'KH'I don't do homework |
 |
|
|
sanjay_jadam
Yak Posting Veteran
53 Posts |
Posted - 2006-01-23 : 03:05:40
|
| i have to show data like this User will enter a YearPlan jan2004--Feb2004----upto--Dec 20051------20---10---------------------202------20---10---------------------203------20---10---------------------20these value (10 or 20)will calculate asIf i want to calculate count of person for jan 2004then i have to calculate count of person from past three month means from Nov2003,Dec2003,Jan2004 months |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
|
|
|