R
R
root092018-11-04 22:03:41
Laravel
root09, 2018-11-04 22:03:41

How to make this request in ORM?

How to make this request in ORM?

SELECT `id` FROM `table` WHERE `field1` >= `field2`;

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
root09, 2018-11-04
@root09

Table::whereRaw('field1 >= field2')->get()

A
Alexander Pushkarev, 2018-11-04
@AXP-dev

Through the model:
Through the table

DB::table('table')->where('field1','>=',field2)->lists('id')->get();

V
Vasyl Fomin, 2018-11-06
@fomvasss

In documentation see "whereColumn" https://laravel.com/docs/5.7/queries#where-clauses

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question