Answer the question
In order to leave comments, you need to log in
How to get the difference of two fields of a Laravel table?
Hello. I have a task of such a plan. There is a number (for example, 5000) and there is a table with data, in the rows there are balance and revers fields in each of these number fields, for example, in the balance field the value is 10000, and in the revers field the value is 20000 and I need to get exactly those rows with one query to the table where the difference between balance and revers is greater than or equal to 5000. Thank you in advance for your answer. Laravel 4.2 framework
Answer the question
In order to leave comments, you need to log in
Guys, help at least with a raw request. I can't figure out how to implement it at all.
Did
SELECT *, reverse - balance AS result FROM purses order by result where result > 5000
$result = Dok::selectRaw('(balance - revers) as results')->where('results', '>', 5000)->orderBy('results', 'desc')->get();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question