[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: [sqr-users] Summing/Sorting



If you are using Oracle 8i and above, you can do this in SQL with the "analytic 
functions":

SQL> select object_id
  2  from (select object_id, sum(object_id) over (order by object_id) as osum
  3        from user_objects)
  4  where osum < 150000;

 OBJECT_ID
----------
     23133
     23134
     23135
     23136
     23137


>>> CGeorge@chubb.com 06/08/05 5:15 AM >>>
Forgive me for not scanning the archives for a solution to this problem,
but I'm not really sure of a succint enough search term.

However, I feel that this is a problem that must have been explored by
someone at some time.

I'm looking for a routine that will, from a list of numbers, sum together
combinations of those numbers until a user defined total is reached and
then present those numbers that have been selected to sum to that total.

Any pointers greatfuly received.

Rgds.,

CG
---

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org 
http://www.sqrug.org/mailman/listinfo/sqr-users


_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users