sql查询,更新,删除,操作。

时间:2021-05-02 19:23:40

UPDATE ht_plan_triptime ppt
SET ppt.lock_status = '1'
WHERE ppt.lock_status <> '1'
    AND ppt.plan_id = ?
    AND ppt.allowed_person > 0
    AND ppt.allowed_person <= (SELECT
                                 COUNT(*)
                               FROM ht_tourist_team_info ti
                                 INNER JOIN ht_order_info oi ON oi.order_id = ti.order_id
                                 INNER JOIN ht_order_team_relation otr ON otr.order_id = oi.order_id AND otr.del_flag = '1'
                               WHERE otr.trip_id = '2f2a83c4fa1749c0ac4ed00626eef91d'
                                   AND ti.del_flag = '1'
                                   AND oi.del_flag = '1'
                                   AND oi.apply_status = '1'
                              )