时间:2021-07-01 10:21:17 帮助过:6人阅读
SELECT (op.cash_payment+op.pos_payment+op.online_payment+op.charge_card_payment) AS real_payment,op.* FROM db_order.`order_payment` AS op WHERE op.order_payment_id in (SELECT oi.order_payment_id FROM db_order.`order_info` AS oi WHERE oi.batch_order_id = '123456') ORDER BY op.insert_time DESC
SELECT (op.cash_payment+op.pos_payment+op.online_payment+op.charge_card_payment) AS real_payment,op.* FROM db_order.`order_payment` AS op,db_order.`order_info` oi WHERE op.order_payment_id=oi.order_payment_id and oi.batch_order_id = '123456' ORDER BY op.insert_time DESC
发给朋友,朋友说相当快,在0.011S。
看来 这个IN确实需要谨慎使用,特别是在两表关联的时候,应该把in替换成内链接
bitsCN.com