?
Solved

database question

Posted on 2007-04-07
5
Medium Priority
?
179 Views
Last Modified: 2010-03-19
database question.
i want to calculate a trend values in a field
i have field which shows total count of numbers. from that i want to show the trend in a separate field. by present date.
how can i do that
i want the query for both access and mssql
can some body help  me in this.
0
Comment
Question by:romeiovasu
  • 3
5 Comments
 
LVL 3

Expert Comment

by:AbhishekSharma
ID: 18869699
Please provide some data
0
 

Author Comment

by:romeiovasu
ID: 18869715
for example
i have count of 100 numbers and i want to forcast for this month
what i am doing in or access manually is
trend = (100/day of the month)*no of days in a month
like
trend = (100/6)*30 = 500
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 1500 total points
ID: 18869757
in access sql

select  (100/Day(Date()) * DaysInMonth(Date())) as trend
from tableName


you need this function (place in a module)

Function DaysInMonth(MyDate)

   ' This function takes a date as an argument and returns
   ' the total number of days in the month.

   Dim NextMonth, EndOfMonth

   NextMonth = DateAdd("m", 1, MyDate)
   EndOfMonth = NextMonth - DatePart("d", NextMonth)
   DaysInMonth = DatePart("d", EndOfMonth)

End Function
0
 

Author Comment

by:romeiovasu
ID: 18869925
can you tell me how to use in a sql query
i got it for access i used in a simple way
DateDiff("d",Date()-(Day(Date()- 1)), DateSerial(Year(Date()),(Month(Date())+1),1))

now i am using sql 2005 i want to get in sql query
0
 

Author Comment

by:romeiovasu
ID: 18869965
ok got it thank you
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ready to get certified? Check out some courses that help you prepare for third-party exams.
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question