A little while ago, I had some help putting together an update query that selected the new data out of a table. It looks something like this:
I tried to copy this to make a new similar query, but it doesn't seem to work... I let it run for about 8 minutes before I cancelled it out. There's not that much data that this would be running that long.
I need to update ClientID on the Assignment table. There's two other tables that are involved... The EventSpare table which contains the AssignmentNumber and ClientName and then the Client table which contains the ClientName and ClientID.
I formulated the following query, but it's not working.
I know it's a bit convoluted and messy, but I don't have much control over the content of some tables. Any guidance would be appreciated!
Code:
UPDATE Assignments
SET EndDate =
(SELECT EndDate
FROM SF.dbo.Events
WHERE SF.dbo.Events.EventNumber = Assignments.AssignmentNumber)
FROM Assignments, SF.dbo.Events
I tried to copy this to make a new similar query, but it doesn't seem to work... I let it run for about 8 minutes before I cancelled it out. There's not that much data that this would be running that long.
I need to update ClientID on the Assignment table. There's two other tables that are involved... The EventSpare table which contains the AssignmentNumber and ClientName and then the Client table which contains the ClientName and ClientID.
I formulated the following query, but it's not working.
Code:
UPDATE Assignments
SET ClientID =
(SELECT ClientID
FROM SF_Clients
WHERE SF_Clients.ClientName = EventSpare.Client
AND EventSpare.AssignmentNumber = Assignments.AssignmentNumber)
FROM Assignments, EventSpare
I know it's a bit convoluted and messy, but I don't have much control over the content of some tables. Any guidance would be appreciated!