K
KERRY J
I have a table (tblWell-Daily) that contains the daily production
volumes for a group of wells. The important fields are:
wellID (primary key)
proddate (primary key)
volume
What I would like to do is determine the number of days that a well (if
any) has been off production (ie. volume=0 ) based on the last date of
input.
The query contains parameter and expression...
LastInput: [Enter Date of Last Data Input mm/dd/yy):]
NumDays: DateDiff("y",[proddate],[LastInput])
Example data would be...
wellID___proddate______volume
well01___11/15/03________0
well01___11/14/03________0
well01___11/13/03______100
well02___11/15/03_______50
...
The query would return wellID (in this case well01), volume (from last
date of prod; in this case 100) and NumDays (in this case 2). The last
date of input in this case would be 11/15/03. If a well is producing on
11/15/03 (volume>0) such as well02, the well would be excluded from the
query results.
I have struggled with this one for several days without achieving the
desired results. My guess is that the query would include a subquery to
handle aggregate functions (ie. Max([proddate]) where volume>0). Thanks
in advance for any help!
volumes for a group of wells. The important fields are:
wellID (primary key)
proddate (primary key)
volume
What I would like to do is determine the number of days that a well (if
any) has been off production (ie. volume=0 ) based on the last date of
input.
The query contains parameter and expression...
LastInput: [Enter Date of Last Data Input mm/dd/yy):]
NumDays: DateDiff("y",[proddate],[LastInput])
Example data would be...
wellID___proddate______volume
well01___11/15/03________0
well01___11/14/03________0
well01___11/13/03______100
well02___11/15/03_______50
...
The query would return wellID (in this case well01), volume (from last
date of prod; in this case 100) and NumDays (in this case 2). The last
date of input in this case would be 11/15/03. If a well is producing on
11/15/03 (volume>0) such as well02, the well would be excluded from the
query results.
I have struggled with this one for several days without achieving the
desired results. My guess is that the query would include a subquery to
handle aggregate functions (ie. Max([proddate]) where volume>0). Thanks
in advance for any help!