I have a database with production estimates from oil wells. The wells come online on a certain date. Production estimates are entered in the database by day. I need to adjust all the [ProductionDates] for a given [WellName] by a certain number of days to create what-if scenarios and so forth. But in order to know how many days to adjust, I need to know what the first date is for each well.
This query (named ProductionDates1)
gives me each Well, and every day of production in the database.
How to I return just the first, earliest date for each Well?
If I run this, I get the date for that first well repeated for every well.
Here's a reference to the Relationships (I did fix the FacilityID/FacilityName)
Thanks!!
Matt
This query (named ProductionDates1)
SQL:
SELECT tblWells.WellName, tblProduction.ProductionDate
FROM tblWells INNER JOIN tblProduction ON tblWells.WellID = tblProduction.WellID
ORDER BY tblWells.WellName, tblProduction.ProductionDate;
gives me each Well, and every day of production in the database.
How to I return just the first, earliest date for each Well?
If I run this, I get the date for that first well repeated for every well.
SQL:
SELECT qryProductionDates1.WellName, Min(qryProductionDates1.ProductionDate) AS MinOfProductionDate
FROM qryProductionDates1
GROUP BY qryProductionDates1.WellName;
Here's a reference to the Relationships (I did fix the FacilityID/FacilityName)
Thanks!!
Matt