I have a table called Todo. This contains a list of id's and a completedDate field which is NULL. There are some other columns but they are not used here.
I then have a query which returns the following data: data
The query is from the same table and is as follows...
SELECT Todo.id, MIN(CloudCall.CloudCallHistory.CallStarted)
FROM Todo
JOIN CloudCall.CloudCallHistory ON CloudCall.CloudCallHistory.ObjectId = Todo.foreignId
JOIN CloudCall.CloudCallNotebookTypeCategoryLink ON CloudCall.CloudCallNotebookTypeCategoryLink.CategoryCode = CloudCall.CloudCallHistory.CategoryId
JOIN NotebookTypes ON NotebookTypes.NotebookTypeId = CloudCall.CloudCallNotebookTypeCategoryLink.NotebookTypeId
WHERE CloudCall.CloudCallHistory.CallStarted > Todo.foreignDate
AND Todo.completedDate IS NULL
AND Todo.cancelledDate IS NULL
AND NotebookTypes.NotebookFolderId = 175
AND CloudCall.CloudCallHistory.CategoryId != 17427
GROUP BY Todo.id
So what I want to do is update the Todo table with the new date where the id's match. Is there anyway to do this in 1 query?
It would look something like this maybe?:
UPDATE Todo
SET completedDate... (SELECT...)
WHERE id = ?
where the select would be the query that returned the data shown in the image. Thanks