Ok,

I need to optimise some code from the coldfusion server and make SQL do the
work, the problem is I have no idea how to attack this.

Here is my problem: I can have a table that returns these records

ID FromDay ToDay Amount IsDay
1       1       3       60      true
2     4     6     55    true
3     7     9     50    true
4     10    10    40    true

Or

ID FromDay ToDay Amount IsDay
1       1       3       60      true
2     4     7     55    true
3     8     9     0    true
4     10    10    40    true

Now the problem I have is that if I want to return data for 12 days, the
first example would be 12 * 40 = $480. The second one would we 10 x $40 =
400. The reason being is that there are 2 free days, but if it was 9 days
then it would be 7 * $55.

This is more complicated than this, but I think if I can begin to get this
happening then I might be able to look into the doing the rest.

Any ideas how to return just the $amount rather than all the rows based on
the number of days?

This really has me stumped, and it is sql server, any help would be
appreciated, thanks.


Andrew Scott
Senior Coldfusion Developer
Aegeon Pty. Ltd.
www.aegeon.com.au
Phone: +613  8676 4223
Mobile: 0404 998 273


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: http://www.houseoffusion.com/groups/SQL/message.cfm/messageid:2646
Subscription: http://www.houseoffusion.com/groups/SQL/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.6

Reply via email to