-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: settlement report - include previous grid owners take 2
- Loading branch information
1 parent
3435da3
commit c00034a
Showing
3 changed files
with
17 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...ttlement-report/DatabaseMigration/Scripts/202412131100_Update_GridAreaOwner_ValidFrom.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
if not exists(select 1 from sys.tables where name = 'GridAreaOwnerBak') | ||
begin | ||
select * | ||
into settlementreports.GridAreaOwnerBak | ||
from settlementreports.gridareaowner | ||
end | ||
|
||
update settlementreports.gridareaowner | ||
set validfrom = '2020-01-01' | ||
where id in (select g.id | ||
from settlementreports.gridareaowner g | ||
join (select code, min(validfrom) as validfrom | ||
from settlementreports.gridareaowner | ||
group by code) temp | ||
on g.code = temp.code and g.validfrom = temp.validfrom) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters