Solved

database question

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
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…

895 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

16 Experts available now in Live!

Get 1:1 Help Now