You will be given questions that you need to solve.
After each exercise, we provide the solution so you can check your answer.
Maybe it doens;t like INNER JOINs on UPDATE statements.
Another problem with it is that it is only updating the row that has the Inspection UID that is equal to @Inspection UID, what I need to do is use the Inspection UID to get the Created Date value and to then update the rows that have the same Created Date value...
A SQL script would be ideal, which would be run every few seconds by an agent.
I've tried declaring a temporary table and updating from that, but that gives me the error DECLARE @T TABLE ( [ID] INT, [X] INT, [Y] INT ) INSERT INTO @T SELECT [ID], [X], [Y] FROM [Redaction] AS R WHERE [ID] IN ( SELECT [Primary ID] FROM [Linked Redactions] ) UPDATE [Redaction] SET [X] = @T.[X], [Y] = @T.[Y] WHERE [Redaction].[ID] IN ( SELECT [ID] FROM @T ) UPDATE red SET [X] = red Primary.[X], [Y] = red Primary.[Y] FROM [Redaction] red INNER JOIN [Linked Redactions] red Lnk ON red.[ID] = red Lnk.
Even if the documentation says you can specify a CTE without declaring the column names, I couldn't do it in this situation, I don't know why.
By commenting, you are accepting the DISQUS terms of service.
Hi all, I am not sure if this is at all possible, but what I want to do is to be able to update a column for X amount of rows where the Date column of the record for the passed in ID is equal to the rows that I want to update and has the value of another column set to 1. Hope you can help with this as I feel I am almost there, but am missing that little something Have you tried this? Is Last Of Day = 0FROM tbl_NSP_Inspection AS INS1 INNER JOIN tbl_NSP_Inspection AS INS2 ON (INS1. Inspection UID)WHERE (Date logic goes here)AND (INS1.
I had to do a very simple Microsoft SQL query in which I wanted to update some of the values in a row from a row in the same table.
Actually, the query was already there, but was using two local variables to store the information, then make the update.