Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: aurora00
  • Content: Threads
  • Order by date
  1. aurora00

    find first n records that adds up to certain amount

    Let's said I have a table with an id column and an amount column. I want to select the first n records that adds up to certain amount, say 100. Something similar to the SQL below: select id, amount from table order by id limit sum(amount) < = 100 Anyway to do it with SQL?

Part and Inventory Search

Back
Top