Q: How to make a where with two fields in Eloquent

- 1 answer

Ad

if I have two fields ( let's say field1 and field2 )

How to make this Query in Eloquent ?

SELECT * FROM `table` WHERE `field1` < `field2`;

$query->where('field1','<','field2')

doesn't work. Backticks doesn't work either ...

Ad

Answer

Ad

$query->whereRaw('field1 < field2');
Ad
source: stackoverflow.com
Ad