CROSS APPLY should do the trick.
On May 11, 10:56 pm, "[email protected]" <[email protected]> wrote: > Hello All, > > I have a query that as a FROM needs two FUNCTIONS > The problem is that one function relies on the other for parameters. > > Below was my first instinct > > f1 - produces a list of years between two dates (2000, 2001, 2002.... > etc) > f2 - does calculations based on these numbers. > > SELECT f1.Value, f2.CalculatedValue1, f2.CalculatedValue2 > FROM f1(DATEPART(yyyy, @StartDate), DATEPART(yyyy, @EndDate)) > CROSSJOIN f2(f1.Value) > > My problem is obviously that this won't work as the parameter for f2 > is not defined at the time the query attempts to call it. > > Any ideas or suggestions? > > Thanks, > > Steve
