Good evening. Based on the example sample file attached, I would have to select all the dates that are the same and are in the same restaurant and that the sum of the quantity is > 10, because I need to disable those dates from my datepicker.
Speak Marlon,
I think you need something like this:
SELECT
t.restaurante,
SUM(t.quantidade) AS quantidade,
t.dataReserva
FROM
teste t
WHERE
t.dataReserva >= NOW()
GROUP BY t.dataReserva, t.restaurante;
Laravel
$reservas = teste::select("restaurante", DB::raw("SUM(t.quantidade) AS quantidade"), "dataReserva")
->where("dataReserva", ">=", date("Y-m-d"))
->groupBy("dataReserva", "restaurante");