S
stephenson22
I have a query: simple extract below.
---------------------------------------------------------------
select
fieldA
fieldB
tableY.Qtr_Value
from tableX
where
fieldA <= tableY.EndDate
And
fieldB >= tableY.EndDate
-----------------------------------------------------------
...........follow me so far )
I have a table (tableY) with the follwing values:
EndDate Qtr_Value
31/09/06 06-07 Qtr2
30/06/06 06-07 Qtr1
31/03/06 05-06 Qtr4
For every occurrance of a row in tableY I would like to insert the value of
EndDate into the SQL query above and for each iteration insert the
corresponding value of Qtr_Value in the SQL query the desired result after
two iterations would look like this:
SQL iteration 1:
-------------------------
select
fieldA
fieldB
tableY.Qtr_Value
from tableX
where
fieldA <= 31/09/06
And
fieldB >= 31/09/06
Result 1:
fieldA, fieldB, Qtr_Value
value, value 2, 06-07 Qtr2
SQL interation 2
-------------------------
select
fieldA
fieldB
tableY.Qtr_Value
from tableX
where
fieldA <= 30/06/06
And
fieldB >= 30/06/06
Result 2:
fieldA, fieldB, Qtr_Value
value, value 2, 06-07 Qtr1
I hope I have made this clear enough for a genius to help me.
Please, please, please )
---------------------------------------------------------------
select
fieldA
fieldB
tableY.Qtr_Value
from tableX
where
fieldA <= tableY.EndDate
And
fieldB >= tableY.EndDate
-----------------------------------------------------------
...........follow me so far )
I have a table (tableY) with the follwing values:
EndDate Qtr_Value
31/09/06 06-07 Qtr2
30/06/06 06-07 Qtr1
31/03/06 05-06 Qtr4
For every occurrance of a row in tableY I would like to insert the value of
EndDate into the SQL query above and for each iteration insert the
corresponding value of Qtr_Value in the SQL query the desired result after
two iterations would look like this:
SQL iteration 1:
-------------------------
select
fieldA
fieldB
tableY.Qtr_Value
from tableX
where
fieldA <= 31/09/06
And
fieldB >= 31/09/06
Result 1:
fieldA, fieldB, Qtr_Value
value, value 2, 06-07 Qtr2
SQL interation 2
-------------------------
select
fieldA
fieldB
tableY.Qtr_Value
from tableX
where
fieldA <= 30/06/06
And
fieldB >= 30/06/06
Result 2:
fieldA, fieldB, Qtr_Value
value, value 2, 06-07 Qtr1
I hope I have made this clear enough for a genius to help me.
Please, please, please )