视图的建立

IF OBJECT_ID ('dbo.VW_Article') IS NOT NULL
    DROP VIEW dbo.VW_Article
GO

CREATE VIEW VW_Article
AS
SELECT 
    a.id,
    a.accountid,
    a.title,
    a.content,
    b.name,
    c.displayname,
    a.soul,
    a.istop,
    a.readtimes,
    a.keywords
FROM
    tong_blog_article a
    LEFT JOIN
    tong_article_category b
    ON a.categoryid=b.id
    LEFT JOIN
    tong_account c
    ON a.accountid=c.id
GO
原文地址:https://www.cnblogs.com/mengxingxinqing/p/3105521.html