Solved

database question

Posted on 2007-04-07
5
166 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 119

Accepted Solution

by:
Rey Obrero earned 500 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 Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
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…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now