Is FromDay and ToDay actual dates?
"This e-mail is from Reed Exhibitions (Gateway House, 28 The Quadrant, Richmond, Surrey, TW9 1DN, United Kingdom), a division of Reed Business, Registered in England, Number 678540. It contains information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you have received this communication in error please return it to the sender or call our switchboard on +44 (0) 20 89107910. The opinions expressed within this communication are not necessarily those expressed by Reed Exhibitions." Visit our website at http://www.reedexpo.com -----Original Message----- From: Andrew Scott To: SQL Sent: Mon Dec 04 06:03:28 2006 Subject: Not sure how to do this 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:2647 Subscription: http://www.houseoffusion.com/groups/SQL/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.6
