Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / March 2006

Tip: Looking for answers? Try searching our database.

Need Formula

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BB - 28 Mar 2006 00:18 GMT
Need a formula that returns Prior Day # - Current Day # for same column, When
Prior is diff record for prior days date.
Tom Ellison - 28 Mar 2006 01:02 GMT
Dear BB:

What you want is probably readily doable, but I cannot give any specifics to
your situation as you have no foundation.

I'm thinking you can already see the Current Day value from your query as it
resides in the current row of the query.

The simplest form (which may not apply to your situation) is:

SELECT MyDate,
   (SELECT MAX(MyDate)
     FROM MyTable T1
     WHERE T1.MyDate < T.MyDate)
   AS PrevDate
 FROM MyTable T
 ORDER BY MyDate

You must fix up table and column names above.

If there are "groups" within the table, and you want the previous date
within the same group:

SELECT MyGroup, MyDate,
   (SELECT MAX(MyDate)
     FROM MyTable T1
     WHERE T1.MyGroup = T.MyGroup
       AND T1.MyDate < T.MyDate)
   AS PrevDate
 FROM MyTable T
 ORDER BY MyGroup, MyDate

Do either of these fit your requirements?  There are numerous combinations
of complexities in doing this.  Without knowing fully or your situation, I
cannot guess at these complexities.

Tom Ellison

> Need a formula that returns Prior Day # - Current Day # for same column,
> When
> Prior is diff record for prior days date.
BB - 28 Mar 2006 16:10 GMT
Thanks Tom,  It is set up where:

3.24.06 Column A= #
3.25.06 Column A=# plus Column B#
I want to take:
3.25.06 Column A + Column B less 3.24.06 for Column A's #= Result

Does this clarify it further?  Thanks for your help.

BB

> Dear BB:
>
[quoted text clipped - 37 lines]
> > When
> > Prior is diff record for prior days date.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.