可以合并为以下一句MySQL语句:

UPDATE CommunicationProfile SET contacts = contacts + IF(username = NEW.contact OR username = NEW.username, 1, 0), contactrequests = contactrequests - IF(contactrequests > 0 AND username = NEW.username, 1, 0), contactrequested = contactrequested - IF(contactrequested > 0 AND username = NEW.contact, 1, 0) WHERE username IN (NEW.username, NEW.contact);

以下三句mysql语句是否可以合并 UPDATE CommunicationProfile SET contacts = contacts + 1 WHERE username = NEWcontact OR username = NEWusername; UPDATE CommunicationProfile SET contactrequests = contactrequests

原文地址: http://www.cveoy.top/t/topic/bv5V 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录