如何在同一SQL表中的本月数据中的下个月更新现有行?
I have one SQL table called Employee_invoice
JobSite | Name | InvocieDate | InvoiceAmount | Crew_size |
---|---|---|---|---|
J003297 | David | 3/1/2022 | 1600 | 10 |
J003297 | Jhon | 5/1/2022 | 2000 | 20 |
J102899 | Andy | 12/1/2022 | 4000 | 30 |
J003297 | Olive | 22/1/2022 | 2000 | 45 |
J003297 | David | 3/2/2022 | 0 | 0 |
J003297 | JHON | 5/2/2022 | 0 | 0 |
J102899 | ANDY ANDY | 12/2/2022 | 0 | 0 |
J003297 | OLIVE | 22/2/2022 | 0 0 | 0, |
所以我想更新InvoiceAceamount,下个月的Crew_size Poind ie ie ie ie c。一个月,即一月。联接条件将在工作地点和名称列上匹配。
我想要为此存储的过程,该过程将每月运行第一天,并更新多列。 (@tableType)
I have one SQL table called Employee_invoice
JobSite | Name | InvocieDate | InvoiceAmount | Crew_size |
---|---|---|---|---|
J003297 | David | 3/1/2022 | 1600 | 10 |
J003297 | Jhon | 5/1/2022 | 2000 | 20 |
J102899 | Andy | 12/1/2022 | 4000 | 30 |
J003297 | Olive | 22/1/2022 | 2000 | 45 |
J003297 | David | 3/2/2022 | 0 | 0 |
J003297 | Jhon | 5/2/2022 | 0 | 0 |
J102899 | Andy | 12/2/2022 | 0 | 0 |
J003297 | Olive | 22/2/2022 | 0 | 0 |
So I want to update InvoiceAmount, Crew_size column of next month i.e. February based Previous month i.e. January month. The join condition will be matched on JobSite and Name column.
I want a stored procedure for this, which will run 1st day of every month and update multiple columns. (@Tabletype)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论