now there is an array. You need to find out the sum of the fields number
when the field card_id
equals each value of the array
. Finally, you want the result to look something like this:
card_id sum
1 10
2 20
currently, you can only traverse queries one by one, and you need to query the database many times: $this- > model- > where ("card_id", $id)-> sum (" number");
I don"t know if there is any way to query all at once