Jim, I really appreciate your help on this I fixed the problem I was having with this
Set @@Duration = 8 SELECT @@Duration - SUM((@@Duration - fromday + 1) * CASE amount WHEN 0 THEN 1 ELSE 0 END) AS FreeDays, MIN(CASE amount WHEN 0 THEN NULL ELSE amount END) AS Amount FROM CarHireRates where (CarHirePricesId = 2) and (FromDay <= @@Duration) Andrew Scott Senior Coldfusion Developer Aegeon Pty. Ltd. www.aegeon.com.au Phone: +613 8676 4223 Mobile: 0404 998 273 -----Original Message----- From: Jim Wright [mailto:[EMAIL PROTECTED] Sent: Tuesday, 5 December 2006 12:47 PM To: SQL Subject: Re: Not sure how to do this Andrew Scott wrote: > Jim, > > That is very impressive I didn't realise that you could do that:-( > > Anyway the code is flawed, the reason being is that the number of free days > should be 0 if the number to hire falls under the free days? Otherwise that > is very close to 50% of my problem. I'm not sure I understand what you are shooting for completely...perhaps another example would help...of course it also may not as I've got a splitting headache tonight, and may just not be seeing the answer. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/SQL/message.cfm/messageid:2655 Subscription: http://www.houseoffusion.com/groups/SQL/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.6
