如何创建将调用您的视图的查询

时间:2016-12-11 16:16:18

标签: sql sql-server

我创建了这个名为[供应商列表]的视图,需要帮助创建一个可以在此处调用供应商列表的查询CREATE VIEW的代码:

CREATE VIEW [Vendors List] 
AS
    SELECT 
        VendorID, 
        SUM(InvoiceTotal) AS [YTD Invoice Total], 
        SUM(PaymentTotal) AS [YTD Payment Total], 
        SUM(CreditTotal) AS [YTD Credit Total]
    FROM 
        dbo.Invoices
    GROUP BY 
        VendorID

2 个答案:

答案 0 :(得分:1)

我无法相信你根据你的问题创建了视图,但是你走了:

select * from [Vendors List]

答案 1 :(得分:0)

从['供应商列表']

中选择*