All - I have what I think, for someone with any level of SQL skills, should be a relatively routine problem to solve.
Right now I have a table called MWDHistory which relates a well to an MWD value effective from a specific day forward until updated again (typically monthly).
The table is laid out as such:
WellID Effective Date MWD
1 01/01/2007 809
1 03/01/2007 700
1 07/01/2007 625
What I need to do is create a select query to return a dataset that carries each effective MWD value forward between one effective date and the subsequent update without the need to store these as separate rows in the MWD history table.
Ideally the output would look like this...
WellID Effective Date MWD
1 01/01/2007 809
1 01/02/2007 809
1 01/02/2007 809
.
.
1 03/01/2007 700
1 03/02/2007 700
I'm doing this so that I can pull the data into an Excel Pivot table and sum the daily MWD value, grouping by Month.
WellID Jan Feb Mar Apr
1 303456 345800 346800 456022
2
3
4
Is there an easy way to do this using a SQL statement?
Thanks in advance any help you can offer!
Regards,
Brian
Right now I have a table called MWDHistory which relates a well to an MWD value effective from a specific day forward until updated again (typically monthly).
The table is laid out as such:
WellID Effective Date MWD
1 01/01/2007 809
1 03/01/2007 700
1 07/01/2007 625
What I need to do is create a select query to return a dataset that carries each effective MWD value forward between one effective date and the subsequent update without the need to store these as separate rows in the MWD history table.
Ideally the output would look like this...
WellID Effective Date MWD
1 01/01/2007 809
1 01/02/2007 809
1 01/02/2007 809
.
.
1 03/01/2007 700
1 03/02/2007 700
I'm doing this so that I can pull the data into an Excel Pivot table and sum the daily MWD value, grouping by Month.
WellID Jan Feb Mar Apr
1 303456 345800 346800 456022
2
3
4
Is there an easy way to do this using a SQL statement?
Thanks in advance any help you can offer!
Regards,
Brian