lundi 27 juillet 2020

Select rows where sum of a column equals a fixed value in Laravel

I would like to get one (or all) possible combination of rows where sum of quantity column equals 20

here an example :

id quantity
1   11          
2   1           
3   4           
4   12          
5   19          
6   10          
7   3           
8   13          
9   16          
10  14  

I want to have less rows, in this example:

5   19 

2   1

If it's impossible this one is acceptable too:

5   19 
9   16 


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/30KfPAk
via IFTTT

Aucun commentaire:

Enregistrer un commentaire