I have an accounting table that contains a dollar amount field. I want to create a view that will return one row for a penny of this amount with some other fields from the table.
So, as a very simple example, let's say I have a line like this:
PK Amount Date
---------------------------
123 4.80 1/1/2012
The request / presentation should return 480 rows (one for each penny), which look like this:
PK Date
-----------------
123 1/1/2012
What will be the most effective way to achieve this? I have a solution that uses a table-based function and a temporary table, but in the back of my head I always think that this needs to be done using the traditional view. Perhaps a creative cross join or something that returns this result without declaring too many resources in the form of temporary tables, but tbf, etc. Any ideas?
source
share