请问 eloquent ORM 如何实现下列 SQL 语句?
laravel 有 whereRaw() 支持带 SQL 函数的语句查询,但好像没找到有叫 updateRaw() 的方法。
UPDATE `transaction_records` SET `relation_id` = CONCAT_WS('-', `seller_id`, `buyer_id`, `product_id`) WHERE `relation_id` = '0-0-0' ORDER BY `id` LIMIT 100;
transaction_records 表有 id, seller_id, buyer_id, product_id, transaction_count, relation_id, created_at, updated_at 等字段,其中 id 为自增主键, seller_id, buyer_id, product_id, relation_id 有普通索引,且前三者默认值为 0 ,最后一个默认值为 ‘0-0-0’ 。
推荐文章: