Select rows until a total amount is met in a column (mysql)

前端 未结 5 851
再見小時候
再見小時候 2020-12-19 23:41

I have seen this issue in SF, but me being a noob I just can\'t get my fried brain around them. So please forgive me if this feels like repetition.

My Sample Table

5条回答
  •  鱼传尺愫
    2020-12-20 00:07

    Standard SQL has no concept of 'what row number am I up to', so this can only be implemented using something called a cursor. Writing code with cursors is something like writing code with for loops in other languages.

    An example of how to use cursors is here:

    http://dev.mysql.com/doc/refman/5.0/en/cursors.html

提交回复
热议问题