读者朋友:
您好,创建这两个视图的代码如下:
CREATE VIEW [dbo].[v_Friend]
AS
SELECT dbo.tb_Friend.ID, dbo.tb_Friend.UserName, dbo.tb_User.NickName,
dbo.tb_User.Sex, dbo.tb_User.BirthDay, dbo.tb_User.Address,
dbo.tb_Friend.FriendName
FROM dbo.tb_Friend INNER JOIN
dbo.tb_User ON dbo.tb_Friend.FriendName = dbo.tb_User.UserName
CREATE VIEW [dbo].[v_msg]
AS
SELECT dbo.tb_Msg.ID, dbo.tb_Msg.Sender, dbo.tb_Msg.MsgDate, dbo.tb_User.NickName,
dbo.tb_Msg.Accepter, dbo.tb_Msg.Msg, dbo.tb_Msg.CheckRead
FROM dbo.tb_Msg INNER JOIN
dbo.tb_User ON dbo.tb_Msg.Sender = dbo.tb_User.UserName