Update query nested select




















For every row in that table, I want to update the 'lastLogDate' column to be the max value of logDate on a per user basis Otherwise be a bit more specific, but from what I get, you should do something along the lines of:. Stack Overflow for Teams — Collaborate and share knowledge with a private group.

Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 9 years, 1 month ago. Active 2 years, 3 months ago. Viewed 82k times. Improve this question. Beth 9, 1 1 gold badge 20 20 silver badges 40 40 bronze badges. How do you plan to keep that information up-to-date? The column that I want to update is " Testfield".

Your set clause needs to have a value to compare to. See this answer by Robin Day for another example. I will also post the example below for viewing ease. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group.

Create a free Team What is Teams? Learn more. Asked 3 years, 8 months ago. Active 3 years, 8 months ago. Get the Latest Bytes Updates. By using this site, you agree to our Privacy Policy and Terms of Use. Nested select SQL within an Update query rotated across multiple columns modernshoggoth 11 G'day all, thanks in advance for reading.

How do I restructure the query so that it just rolls over them all, updating the 'Licence01' column for each employee?

Or should I be going about this a different way? Licences; It still prompts for both EmployeeID's but now it updates ALL employees with that particular Employee's first Licence - how do I get it to look at each employees and update their own first Licence? Jan 19 '09 reply modernshoggoth 11 I'm aware that two copies of the same data isn't the best way to do things, but the ID-card software this is designed for uses the [IDProjectData] table, and is very strict about how data is accessed.

Jan 19 '09 reply modernshoggoth 11 The software that accesses the database can only use THAT particular table, and can only use certain cells in certain ways.

Jan 20 '09 reply modernshoggoth 11 Unfortunately it doesn't like working from a selected crosstab query - I've tried that. Jan 20 '09 reply Message. Cancel Changes. DB2 Database nested select question 3 posts views Thread by Tcs last post: by.

General lancet: a comprehensive, efficient, and reusable util function library of go reply views Thread by lanliddd last post: by. Asked 6 years, 7 months ago. Active 6 years, 7 months ago. Viewed 7k times.

Improve this question. JacobL JacobL 11 1 1 silver badge 2 2 bronze badges. PHPMyAdmin suggests the first. The lack of ; suggests SQL-Server.

Which one do you use? There should be ; at the end of each statement but when I copied them over I didn't add them in. I removed the "sql-server" tag. The error "every derived table..



0コメント

  • 1000 / 1000