View: dbo.Payable_Transaction_N_Payroll_Check_View
View definition
`-- Once upon a time, there was a table in the database named Payable_Transaction_N_Payroll_Check. This table linked a -- given payroll check with all the payroll liabilities (payable transactions) it generated. This arrangement proved to -- be inadequate. The Payable_Transaction_N_Payroll_Check table was replaced with three dictionary tables that linked -- various payroll check detail with the liabilities they generated. To make this replacement easier, this view was -- created to generate the contents of the original table from the three new tables. --drop view dbo.Payable_Transaction_N_Payroll_Check_View create view dbo.Payable_Transaction_N_Payroll_Check_View as -- SELECT payable_transaction_KEY, bank_transaction_KEY FROM ( select payable_transaction_KEY , bank_transaction_KEY from dbo.Payable_Transaction_N_Payroll_Check_Payroll_Item PTNPCPI join dbo.Payroll_Check_Payroll_Item PCPI on PTNPCPI.payroll_check_payroll_item_KEY = PCPI.payroll_check_payroll_item_KEY UNION select payable_transaction_KEY , bank_transaction_KEY from dbo.Payable_Transaction_N_Payroll_Check_Tax_Item PTNPCTI join dbo.Payroll_Check_Tax_Item PCTI on PTNPCTI.payroll_check_tax_item_KEY = PCTI.payroll_check_tax_item_KEY UNION SELECT payable_transaction_KEY , bank_transaction_KEY from dbo.Payable_Transaction_N_Payroll_Bank_Transaction_Worker_Compensation_Item PTNPBTWCI join dbo.Payroll_Bank_Transaction_Worker_Compensation_Item PBTWCI on PTNPBTWCI.payroll_bank_transaction_worker_compensation_item_KEY = PBTWCI.payroll_bank_transaction_worker_compensation_item_KEY ) as MyTable`