日期:2014-05-16 浏览次数:20446 次
CREATE TABLE [dbo].[tZ_ProfessorEvent](
[UserId] [int] NULL,
[ZJBH] [varchar](20) NULL,
[XM] [varchar](200) NULL,
[QuestCount] [int] NULL,
[QuestTimes] [int] NULL,
[VerifyCount] [int] NULL,
[F20012026] [int] NULL,
[T20012026] [int] NULL,
[F20012027] [int] NULL,
[T20012027] [int] NULL,
[F20012028] [int] NULL,
[T20012028] [int] NULL,
[F20012029] [int] NULL,
[T20012029] [int] NULL,
[F20012031] [int] NULL,
[T20012031] [int] NULL
) ON [PRIMARY]
CREATE TABLE [dbo].[tZ_t1](
[userId] [int] NULL,
[taskFlowID] [int] NULL,
[QuestCount] [int] NULL,
[QuestTimes] [int] NULL
) ON [PRIMARY]
UPDATE [dbo].[tZ_ProfessorEvent] SET
F20012026 = CASE tZ_t1.taskFlowID WHEN 20012026 THEN dbo.tZ_t1.QuestCount ELSE 0 end,
F20012027 = CASE tZ_t1.taskFlowID WHEN 20012027 THEN dbo.tZ_t1.QuestCount ELSE 0 end,
F20012028 = CASE tZ_t1.taskFlowID WHEN 20012028 THEN dbo.tZ_t1.QuestCount ELSE 0 end,
F20012029 = CASE tZ_t1.taskFlowID WHEN 20012029 THEN dbo.tZ_t1.QuestCount ELSE 0 end
FROM
dbo.tZ_t1 WHERE dbo.tZ_t1.userId = [tZ_ProfessorEvent].UserId
UPDATE [dbo].[tZ_ProfessorEvent] SET
F20012026 = CASE t.taskFlowID WHEN 20012026 THEN t.QuestCount ELSE 0 end,
F20012027 = CASE t.taskFlowID WHEN 20012027 THEN t.QuestCount ELSE 0 end,
F20012028 = CASE t.taskFlowID WHEN 20012028 THEN t.QuestCount ELSE 0 end,
F20012029 = CASE t.taskFlowID WHEN 20012029 THEN t.QuestCount ELSE 0 end
FROM [dbo].[tZ_ProfessorEvent] e INNER JOIN dbo.tZ_t1 t ON t.userId = e.UserId