datediff question

H

Harold Ducote

I'm running a query to tell me the total number of days which is Sum((DateDiff("d",[ddate],[return_date])))

how can i limit the answer to calculate just past 30 days, 60 days and not the total number of days
 
V

Van T. Dinh

Most potential respondents will ignore posts with attachments.

Repost WITHOUT attachments and with appropriate details, e.g. which date do
you want to be in the last 30 days. Remember, we don't see your database.

--
HTH
Van T. Dinh
MVP (Access)




I'm running a query to tell me the total number of days which is
Sum((DateDiff("d",[ddate],[return_date])))

how can i limit the answer to calculate just past 30 days, 60 days and not
the total number of days
 
H

Harold Ducote

the past 30 days. or 60 days, so it would be from today -30 days ago, during that period.

Most potential respondents will ignore posts with attachments.

Repost WITHOUT attachments and with appropriate details, e.g. which date do
you want to be in the last 30 days. Remember, we don't see your database.

--
HTH
Van T. Dinh
MVP (Access)




I'm running a query to tell me the total number of days which is
Sum((DateDiff("d",[ddate],[return_date])))

how can i limit the answer to calculate just past 30 days, 60 days and not
the total number of days
 
J

John Spencer (MVP)

Not exactly sure what your question is. Do you want to return values from the
calculation that are in even 30 day increments?

30 * (Sum((DateDiff("d",[ddate],[return_date])))\30)

That will give you
zero for 0-29 days
30 for 30 to 59 days
60 for 60 to 89 days
...

Is that what you want? Or are you trying to get some other results? You may
need to restate your question and give us some examples of the data you have and
the result you want to see.


I'm running a query to tell me the total number of days which is Sum((DateDiff("d",[ddate],[return_date])))

how can i limit the answer to calculate just past 30 days, 60 days and not the
total number of days
 
H

Harold Ducote

no what i want to see all the equipment rented in the past 30, 60, 90 etc days with number of days rented during that time, for example serial number 1 in the past 30 days rented 15, but in the last 60 days it rented 45.

something i guest like from today back 30, 60, 90 days, in the query.


Not exactly sure what your question is. Do you want to return values from the
calculation that are in even 30 day increments?

30 * (Sum((DateDiff("d",[ddate],[return_date])))\30)

That will give you
zero for 0-29 days
30 for 30 to 59 days
60 for 60 to 89 days
...

Is that what you want? Or are you trying to get some other results? You may
need to restate your question and give us some examples of the data you have and
the result you want to see.


I'm running a query to tell me the total number of days which is Sum((DateDiff("d",[ddate],[return_date])))

how can i limit the answer to calculate just past 30 days, 60 days and not the
total number of days
 
Top