dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Implementing Fibonacci in SQL2000

  1. #1
    Join Date
    Nov 2005
    Posts
    20

    Question Implementing Fibonacci in SQL2000

    Hi,

    Can somebody help me implement fibonacci in SQL2000?

    I have a table 'CUSTOMER' as follows

    CUSTOMER AMOUNT

    A 1000
    B 2000
    c 8000
    d -6000
    e 11000
    f -3500

    I need to apply fibonacci to get another column 'BALANCE' in the same table as follows

    CUSTOMER AMOUNT BALANCE

    A 1000 1000
    B 2000 3000
    c 8000 11000
    d -6000 5000
    e 11000 16000
    f -3500 12500

    Balance is cumulative addition of all values in 'AMOUNT'

    Thanking you in anticipation.

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Jul 2007
    Posts
    161
    Is there an ID of some sort on the customer amount data?

    If so you could sort by the ID use a sub select statement to return the balance for all ID <= current id.

Similar Threads

  1. Recursively compute the Nth Fibonacci number:
    By aesoprock00 in forum Java
    Replies: 4
    Last Post: 11-21-2009, 08:07 AM
  2. Replies: 1
    Last Post: 12-10-2002, 03:05 PM
  3. Replies: 0
    Last Post: 10-25-2002, 02:55 PM
  4. Learning SQL2000
    By Mark Newman in forum authorevents.vieira
    Replies: 1
    Last Post: 01-27-2001, 06:02 PM
  5. transaction log backup in SQL2000
    By Oleg in forum Database
    Replies: 1
    Last Post: 12-01-2000, 09:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center