PostgreSQL
 SQL >> Database >  >> RDS >> PostgreSQL

Confrontare due colonne in Laravel con PostgreSQL

where('calls', '<', 'maxcalls') tratta 'maxcalls' come valore letterale, non come colonna.

Usa whereRaw oppure, nelle versioni recenti, whereColumn:

whereColumn('calls', '<', 'maxcalls')

Se l’espressione include input utente, usa binding:

whereRaw('calls < maxcalls AND maxcalls > ?', [$minimum]);