I am using laravel 4 query. I want get data by OR condition. Is there any priority rule with Laravel 4 ?
My Query is :
SELECT *
FROM order_items
WHERE (status = 'Y' OR (status = 'N' AND amount > 100))
AND product_id = '15'
LIMIT 1;
I have 2 order items but i want the first item in the result will get the prority status = 'Y', if its not there, then it meet the second condition of OR.
Here is my laravel code :
$sql_select = "SELECT *
FROM order_items
WHERE (status = 'Y' OR (status = 'N' AND amount > 100))
AND product_id = '15'
LIMIT 1";
$data = DB::select($sql_select);
echo "<pre>";
print_r($data);
die;
For simple mysql query, its working, but in laravel its not giving results.