MySQL if else相关函数

MySQL查询结果使用if else

SELECT IF(sex=1,'男','女') FROM doctor

mybatis类似if else 的查询方式

select * from p
where 1 = 1
<choose>
      <when  test="cityId != null ">
        cityId = 1
      </when >
      <otherwise>
        cityId = 0
      </otherwise>
</choose>
发布了51 篇原创文章 · 获赞 18 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/m0_37882063/article/details/88597349
今日推荐