select
case
when
(select count(*) from tasks t where t.CUSTID='DPR01' and t.INTID='INT0001'>0)
then
UPDATE tasks_master_tracker_idb SET
CLIENT_CONTACT = (SELECT t.CLIENT_CONTACT FROM tasks t WHERE t.CUSTID='DPR01' AND t.INTID='INT0001'),
COMPLEXITY = (SELECT t.COMPLEXITY FROM tasks t WHERE t.CUSTID='DPR01' AND t.INTID='INT0001'),
CREATED_BY = (SELECT t.CREATED_BY FROM tasks t WHERE t.CUSTID='DPR01' AND t.INTID='INT0001'),
CUSTID = (SELECT t.CUSTID FROM tasks t WHERE t.CUSTID='DPR01' AND t.INTID='INT0001'),
DIRECTION = (SELECT t.DIRECTION FROM tasks t WHERE t.CUSTID='DPR01' AND t.INTID='INT0001'),
INTEGRATION_ID = (SELECT t.INTID FROM tasks t WHERE t.CUSTID='DPR01' AND t.INTID='INT0001'),
INTEGRATION_NAME = (SELECT t.NAME FROM tasks t WHERE t.CUSTID='DPR01' AND t.INTID='INT0001'),
INTEGRATION_STATUS = (SELECT t.STATUS FROM tasks t WHERE t.CUSTID='DPR01' AND t.INTID='INT0001'),
INTEGRATION_TYPE = (SELECT t.PROJ_TYPE FROM tasks t WHERE t.CUSTID='DPR01' AND t.INTID='INT0001'),
VENDOR = (SELECT t.VENDOR FROM tasks t WHERE t.CUSTID='DPR01' AND t.INTID='INT0001')
WHERE
CUSTID='DPR01'
AND
INTEGRATION_ID='INT001'
else
INSERT into tasks_master_tracker_idb (
CLIENT_CONTACT, COMPLEXITY, CREATED_BY, CUSTID, DIRECTION,
INTEGRATION_ID, INTEGRATION_NAME, INTEGRATION_STATUS, INTEGRATION_TYPE, VENDOR
)
SELECT t.CLIENT_CONTACT, t.COMPLEXITY, t.CREATED_BY, t.CUSTID, t.DIRECTION,
t.INTID, t.NAME, t.STATUS, t.PROJ_TYPE, t.VENDOR
FROM
tasks t
WHERE
t.CUSTID='DPR01'
AND
t.INTID='INT0001'
end
I'm getting an error that says, "Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE tasks_master_tracker_idb SET CLIENT_CONTACT = (SELECT t.CLIENT_CONTA' at line 6Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.
This award recognizes a member of Experts Exchange who has made outstanding contributions to the community within their first year as an expert. The Rookie of the Year is awarded to a new expert who has the highest number of quality contributions.