I have a query (MySQL) which pulls data from 4 tables within the same database. What I would like to do is run the query and have the results be either updated if there was a change and have new records be inserted into a separate table in another database.

Code:
    SELECT a.Created,
    a.id 'TicketID',
    GROUP_CONCAT((CASE WHEN d.CustomField = 1 THEN d.Content ELSE NULL END)) `CompanyName`,
    a.Subject,
    c.Name Queue,
    b.Name 'Owner',
    a.`Status`,
    a.LastUpdated,
    GROUP_CONCAT((CASE WHEN d.CustomField = 4 THEN d.Content ELSE NULL END)) `Location`,
    a.TimeWorked 'TimeWorked',
    GROUP_CONCAT((CASE WHEN d.CustomField = 2 THEN d.Content ELSE NULL END)) `OverRide`,
    a.Resolved
    FROM    rt.Tickets a
        INNER JOIN rt.Users b
            ON a.owner = b.id
        INNER JOIN rt.Queues c
            ON a.queue = c.id
        INNER JOIN  rt.ObjectCustomFieldValues d
            ON a.id = d.ObjectID
    GROUP BY a.id
The above query is pulls data from our ticketing system.

I was able to initally insert the data using the following:

Code:
    INSERT INTO Support (Created, TicketID, CompanyName, Subject, Queue, Owner, Status, LastUpdated, Location, Timeworked, OverRide, Resolved)
    SELECT a.Created,
    a.id 'TicketID',
    GROUP_CONCAT((CASE WHEN d.CustomField = 1 THEN d.Content ELSE NULL END)) `CompanyName`,
    a.Subject,
    c.Name Queue,
    b.Name 'Owner',
    a.`Status`,
    a.LastUpdated,
    GROUP_CONCAT((CASE WHEN d.CustomField = 4 THEN d.Content ELSE NULL END)) `Location`,
    a.TimeWorked 'TimeWorked',
    GROUP_CONCAT((CASE WHEN d.CustomField = 2 THEN d.Content ELSE NULL END)) `OverRide`,
    a.Resolved
    FROM    rt.Tickets a
        INNER JOIN rt.Users b
            ON a.owner = b.id
        INNER JOIN rt.Queues c
            ON a.queue = c.id
        INNER JOIN  rt.ObjectCustomFieldValues d
            ON a.id = d.ObjectID
    GROUP BY a.id
However when trying to update the data that is already there or adding additional new data I get errors.

Code:
    UPDATE Support
    (SELECT a.Created,
    a.id 'TicketID',
    GROUP_CONCAT((CASE WHEN d.CustomField = 1 THEN d.Content ELSE NULL END)) `CompanyName`,
    a.Subject,
    c.Name Queue,
    b.Name 'Owner',
    a.`Status`,
    a.LastUpdated,
    GROUP_CONCAT((CASE WHEN d.CustomField = 4 THEN d.Content ELSE NULL END)) `Location`,
    a.TimeWorked 'TimeWorked',
    GROUP_CONCAT((CASE WHEN d.CustomField = 2 THEN d.Content ELSE NULL END)) `OverRide`,
    a.Resolved
    FROM    rt.Tickets a
        INNER JOIN rt.Users b
            ON a.owner = b.id
        INNER JOIN rt.Queues c
            ON a.queue = c.id
        INNER JOIN  rt.ObjectCustomFieldValues d
            ON a.id = d.ObjectID
    GROUP BY a.id)
I am not sure that is the issue is on the update query.
Thanks,