By ‘fixed vector’ I mean a static list of values, like 1 through 24.
The current query looks like this (simplified)
SELECT Period, Profit FROM Projections
But the data is ‘sparse’ — so there’s not a row for every period.
What query will give me a row for peiods 1-24 every time, with zeros (or NULLs) where there’s no data?
I would like to do this with just the query to avoid a mess of client code.
Thanks!
You could make a udf called udfRange(start int,count int) or something like that, and left-join to the output of the function.
Or for something really quick and dirty, you could join to a subselect that looked like