我有一个很长的查询,我需要在yii1.1中参数化。有人能帮我吗?
$command = Yii::app()->db->createCommand("UPDATE visit
LEFT JOIN card_generated ON card_generated.id = visit.card
SET visit_status = " . VisitStatus::CLOSED . ",card_status =" . CardStatus::NOT_RETURNED . "
WHERE CURRENT_DATE > date_out AND visit_status = " . VisitStatus::ACTIVE . "
AND card_status = " . CardStatus::ACTIVE . " and (card_type= " . CardType::SAME_DAY_VISITOR . " OR card_type=" . CardType::TEMPORARY_ASIC . ")")->execute();
1条答案
按热度按时间zbdgwd5y1#
请参考stackoverflow问题here无论哪种方式,您都可以使用bind param选项。请在此处查看文档以获取更多信息。文档中的一个示例如下所示。