ZL_Plat_BlogView
GO
CREATE VIEW [dbo].[ZL_Plat_BlogView] AS
SELECT
CateID=0,CateName='',ID,Pid,ReplyID,MsgType,Title,MsgContent,ReplyUserID,ColledIDS,LikeIDS,[Status],CUser,CUName,CDate,
GroupIDS,[Attach],EndTime,VoteOP,VoteResult,ForwardID,ATUser,CompID,
ReplyUName,Location,Source='plat',ReadNumber
FROM ZL_Plat_Blog Union ALL
SELECT A.Cateid,A.CateName,-B.ID AS ID,-B.Pid AS Pid,-B.ReplyID AS ReplyID,MsgType,Title,MsgContent,ReplyUserID,ColledIDS,LikeIDS,B.[Status],CUser,CUName,CDate,
GroupIDS='',[Attach]='', EndTime='2016-09-14 18:29:21.123',VoteOP='',VoteResult='',ForwardID=0,ATUser='',IsPlat AS CompID,
ReplyUName=CUName,Location='',Source='bar',ReadNumber=0 FROM ZL_Guestcate A LEFT JOIN ZL_Guest_Bar B ON A.Cateid=B.CateID
WHERE A.IsPlat>0 AND B.[Status]=99
detele from ZL_Plat_BlogView
drop table ZL_Plat_BlogView
TRUNCATE table ZL_Plat_BlogView