logo  

Java编程实用经验

Java编程实用经验
作者: 陈安廉

摘要:软件开发进阶系列


复杂删除


2020-12-13 09:54:41



-- 连表删除,删除系统类消息
DELETE wx_message FROM wx_message,wx_session 
    WHERE wx_message.session_id = wx_session.id 
    AND wx_session.`type` =2

-- 删除系统会话
DELETE FROM wx_session  where wx_session.`type` =2



 -- 子查询删除,删除没有会话的会话跟进
DELETE
FROM
	wx_session_follower
WHERE
	wx_session_follower.session_id not in (
	SELECT
		*
	FROM
		(
		SELECT
			a.id
		FROM
			wx_session a ) ee )
			

联表更新			

update
	biz_charge_gun bcg
inner join biz_charge_pile bcp on
	bcg.cp_id = bcp.id set
	bcg.connector_type = 4,
	bcg.r_v_upper_limits = 220,
	bcg.r_v_lower_limits = 220,
	bcg.r_current = 1000,
	bcg.r_power = 120
where
	bcp.pile_type = 1