SELECT [Department]
      ,[#]
      ,[Created Date]
      ,[Planned Date]
      ,[Planned Time]
      ,[Staff Name]
      ,[Dealer]
      ,[Addr# 1]
      ,[Addr# 2]
      ,[Model No#]
      ,[Problem 1]
      ,[Problem 2]
      ,[Problem 3]
      ,[Problem leading to delay]
      ,[Res]
      ,[Contact]
      ,[Tel 1]
      ,[Tel 2]
      ,[e-mail address]
      ,[Type]
      ,[Job status]
      ,[Job status date]
      ,[FSO#]
      ,[Amount]
      ,[Paid]
      ,[Quotation#]
      ,[Warranty Card#]
      ,[Status]
      ,[Status_Deadline]
      ,[Step]
      ,[Call you in advance]
      ,[Arrive on time]
      ,[Identity and Uniform]
      ,[Satisfied with service]
      ,[Politeness]
      ,[Solve the issue]
      ,[Recommend Johnson Controls]
      ,[Any comment]
  FROM [JCIHKEroom1].[dbo].[temp]这里面有两个字段,分别是:[Addr# 1],[Addr# 2],我想在查询的时候,把这两个字段里面的值加到一起输出出来,[Addr# 2]这个字段里面有空值,我用:[Addr# 1]+[Addr# 2],这样是查不出来的,大家看看有什么好办法没?

解决方案 »

  1.   

    ISNULL([Addr# 1],'')+ISNULL([Addr# 2],'')
      

  2.   

    SELECT [Department]
          ,[#]
          ,[Created Date]
          ,[Planned Date]
          ,[Planned Time]
          ,[Staff Name]
          ,[Dealer]
          ,[Addr# 1]
          ,[Addr# 2]
          -----------------
          ,ISNULL([Addr# 1],'')+ISNULL([Addr# 1],'') ADD_RESS
          ------------
          ,[Model No#]
          ,[Problem 1]
          ,[Problem 2]
          ,[Problem 3]
          ,[Problem leading to delay]
          ,[Res]
          ,[Contact]
          ,[Tel 1]
          ,[Tel 2]
          ,[e-mail address]
          ,[Type]
          ,[Job status]
          ,[Job status date]
          ,[FSO#]
          ,[Amount]
          ,[Paid]
          ,[Quotation#]
          ,[Warranty Card#]
          ,[Status]
          ,[Status_Deadline]
          ,[Step]
          ,[Call you in advance]
          ,[Arrive on time]
          ,[Identity and Uniform]
          ,[Satisfied with service]
          ,[Politeness]
          ,[Solve the issue]
          ,[Recommend Johnson Controls]
          ,[Any comment]
      FROM [JCIHKEroom1].[dbo].[temp]
      

  3.   

    这样就行了ISNULL([Addr# 1],'')+ISNULL([Addr# 1],'')
    一二楼已经解决此问题。