Answer the question
In order to leave comments, you need to log in
How to correctly formulate a query to the database or maybe there is a better solution?
Hello everyone, guys, tell me how to formulate the request correctly, I make cumulative discounts and here is the request
$queryResults = Yii::app()->db->createCommand()->
select( '*' )->
from('DiscountRegular')->
where('active = "1" AND start_date <= CURRENT_TIMESTAMP() AND end_date >= CURRENT_TIMESTAMP() AND price >= '.$regular_discount.'')->
queryAll();
Answer the question
In order to leave comments, you need to log in
Try to swap if the base allows it (tested on the muscle - it allows):
$queryResults = Yii::app()->db->createCommand()->
select( '*' )->
from('DiscountRegular')->
where('active = "1" AND start_date <= CURRENT_TIMESTAMP() AND end_date >= CURRENT_TIMESTAMP() AND ' . $regular_discount . ' >= price')->
queryAll();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question