如何将这些查询放在一起?

时间:2014-02-26 01:31:42

标签: sql

UPDATE [PipeLine] SET [PipeLine].[Building Rating] = 'A-'
WHERE ((([PipeLine].[NDA Status])<>'No' And ([PipeLine].[Building Status])<>'No') AND (([PipeLine].[Deal With Partner])<>'No') AND (([PipeLine].LAND)<>'No') AND (([PipeLine].Connect)<>'No'));

UPDATE [PipeLine] SET [PipeLine].[Building Rating] = 'B'
WHERE ((([PipeLine].[Building Status])<>'No' And ([PipeLine].[Building Status])<>'No') AND (([PipeLine].[Deal With Partner])<>'No'));

1 个答案:

答案 0 :(得分:1)

UPDATE [PipeLine] 
SET [PipeLine].[Building Rating] = 
   CASE
     WHEN ((([PipeLine].[NDA Status])<>'No' And ([PipeLine].[Building Status])<>'No') AND (([PipeLine].[Deal With Partner])<>'No') AND (([PipeLine].LAND)<>'No') AND (([PipeLine].Connect)<>'No'))
      THEN 'A-'
     WHEN ((([PipeLine].[Building Status])<>'No' And ([PipeLine].[Building Status])<>'No') AND (([PipeLine].[Deal With Partner])<>'No'))
      THEN 'B'
   END;