How do I rewrite such sql into Eloquent style?

Posted 2 months ago by phoenixg
$sql = "(
                select ch_id from Charge 
                    where ch_order_no = :id and ch_app_id = 'app_id'
                union all
                select ch_id from Charge
                    where ch_id = :id and ch_app_id = 'app_id'
            ) as " . Charge::db()->getTablePrefix() . "t";
$queryCount = Charge::db()->table(Charge::db()->raw(str_replace('\n', ' ', $sql)));

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.