我正在尝试根据在Payment
桌子上完成的付款创建发票视图。视图上的字段是和字段Balance
之间的差异。当我插入付款表余额字段时显示为空。 AmountDue
AmountPaid
CREATE TABLE [dbo].[payment](
[AmountDue] [money] NULL,
[AmountPaid] [money] NULL,
[Balance] [money] NULL,
[CheckNumber] [varchar](50) NULL
) ON [PRIMARY]
我的观点:
CREATE VIEW [dbo].[invoice]
AS
SELECT AmountDue, AmountPaid, Balance AS [[AmountPaid-AmountDue]] AS Bal], CheckNumber
FROM dbo.payment
去