Posted by edouard.spooner on 11/02/06 10:11
Hi,
I have a tricky SQL query problem that I'm having probs with.
I have a table which resembles something like this
Date | Price1 | Price2 | Price3
01 Jan 2006 | 100 | 100 | 100
02 Jan 2006 | 100 | 100 | 100
03 Jan 2006 | 100 | 100 | 100
04 Jan 2006 | 115 | 100 | 100
05 Jan 2006 | 115 | 100 | 100
06 Jan 2006 | 115 | 115 | 115
07 Jan 2006 | 115 | 100 | 100
08 Jan 2006 | 100 | 100 | 100
09 Jan 2006 | 100 | 100 | 100
and I want to write a query/view that will return this
>From | To | Price1 | Price2 | Price3
01 Jan 2006 | 03 Jan 2006 | 100 | 100 | 100
04 Jan 2006 | 05 Jan 2006 | 115 | 100 | 100
06 Jan 2006 | 06 Jan 2006 | 115 | 115 | 115
07 Jan 2006 | 07 Jan 2006 | 115 | 100 | 100
08 Jan 2006 | 09 Jan 2006 | 100 | 100 | 100
Any ideas?
I know how to write a routine that would do the same in VB but I am
looking to do a lot of the same calculation/query so I need it to be
fast (which VB wouldnt be)
TIA
Eddie
[Back to original message]
|