How to get the accumulated data that satisfies a certain value from the database

for example:

< table > < thead > < tr > < th > id < / th > < th > num < / th > < / tr > < / thead > < tbody > < tr > < td > 1 < / td > < td > 1 < / td > < / tr > < tr > < td > 2 < / td > < td > 20 < / td > < / tr > < tr > < td > 3 < / td > < td > 30 < / td > < / tr > < tr > < td > 4 < / td > < td > 40 < / td > < / tr > < / tbody > < / table >

get the ID of num accumulating no more than N or more than 1 piece of data

for example, if you need 1"20"30 to take out ID:1,2,3
Never51, then it happens to be 1, 2, 3, and 3 to take out

, if you need 1"20"30 to take it out, and there is still room to take it out

.
Mar.20,2021
Menu