不是Null在Mysql中的Case语句中不起作用

时间:2014-09-08 10:52:34

标签: mysql

我需要什么:

这是我的Api

metadata: {},
user_id: 142517,
linkedinId: null,
facebookId: "https:m",
linkedinProfile: null,
profile: null,
edition: "current",
social: "1"
  • 我只想要那个
    • linkedinProfile为null,
    • 个人资料为空
    • country is not null

我的查询

               (case
                when (TRIM(user.linkedinProfile) <>'' or TRIM(user.profile)<>'') and user.country= '$country_code'
                then 1
                when
                TRIM(user.linkedinProfile) <>''  or TRIM(user.profile)<>''
                then 2
                when  user.country='$country_code'
                then 3
            else 4 end)  social 
  • 我使用了NOT Null,但它无效。
  • 问题我得到的是应用条件社交不应该是1,它会2,3或者其他。

输出:

   social  in Api should 2, 3 else but not to be  1 as per my sql condition.

0 个答案:

没有答案