mirror of
https://github.com/acedanger/budget-database.git
synced 2025-12-05 22:50:13 -08:00
database redesign
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
use Leo
|
||||
go
|
||||
|
||||
create view dbo.vw_BUDGET_RUNNING_BAL
|
||||
as
|
||||
select
|
||||
BDT_DATE, BDT_DESCRIPTION, BDT_AMOUNT
|
||||
, sum(BDT_AMOUNT) over(order by BDT_DATE, BDT_AMOUNT desc rows unbounded preceding) RUNNING_BAL
|
||||
alter view dbo.vw_BudgetRunningBalance
|
||||
as
|
||||
select
|
||||
TrxId, TrxDate, TrxDate_ISO8601=convert(datetime, TrxDate, 126), TrxDescription, TrxAmount
|
||||
, sum(TrxAmount) over(order by TrxDate, TrxAmount desc rows unbounded preceding) RunningBal
|
||||
from dbo.BUDGET_DETAIL
|
||||
@@ -1,8 +1,8 @@
|
||||
use Leo
|
||||
go
|
||||
|
||||
create view dbo.vw_CURR_MONTH_BUDGET
|
||||
alter view dbo.vw_CurrentMonthBudget
|
||||
as
|
||||
select *
|
||||
from dbo.vw_BUDGET_RUNNING_BAL
|
||||
where BDT_DATE between dateadd(DAY, 1, EOMONTH(getDate(), -1)) and eomonth(getDate())
|
||||
select *
|
||||
from dbo.vw_BudgetRunningBalance
|
||||
where TrxDate between dateadd(DAY, 1, EOMONTH(getDate(), -1)) and eomonth(getDate())
|
||||
Reference in New Issue
Block a user