A
A
Alide2020-05-31 12:56:46
PHP
Alide, 2020-05-31 12:56:46

How? Getting the amount from Mysql with a condition, how?

I have an invoice now

$all_win = 0;
foreach ($liveDrop as $live) {
            $all_win += Item::where('id', $live->item_id)->sum('sell_price');
}

Table
5ed37ef874823891928599.png

In my script now, the item id of all of this table is being detected and the sum of these Items is summed up. But I need to remake it so that it counts only those rows where key is NOT equal to L2MBD4 , that is, so that the calculation goes the same way, only rows where the column = L2MBD4 are not taken into account. How to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2020-05-31
@FanatPHP

select sum(sell_price) where key <> 'L2MBD4 '

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question