Hi everyone I'm using Laravel and I'm trying to get a single value from the database using pluck
,
the issue is the query must be written in the Laravel way not the normal sql.so how to write this
sql query in Laravel ? I want to be able use AS
to change the column name and SUM
.all I want actually is to get the value from total_quantity
column to do that I have to use pluck.
any idea how to write that query ?
Thanks in advance.
$PhysicalStock=DB::select("select sum(quantity) as `total_quantity` from InOutProducts where productID=$productID and InAndOut=1;")->pluck('total_quantity');