判断字段是否为null select * from table where c is null select * from table where c is not null 判断字段是否为空 select * from table where c='' select * from talbe where c<>''
零:sql动态语句中经常会有根据数据库某个字段状态进行判断的 如:status=0为未激活,status=1为激活的,那搜索未激活时: <if test="model.activeStatus != null and model.activeStatus !='' or model.activeStatus==0"> and status=#{model.activeStatus} </if> 但由于java的int类型默认值为0,导致0与null的判定无法识别
SELECT TOP 1000 [id], case when group_id>1 then 'vip' else '普通会员' end FROM [YaleBaoV2].[dbo].[ylb_users] SELECT TOP 1000 [id], case group_id when 1 then '普通会员' when 3 then '代理商' when 4 then 'VIP用户
导入*.sql数据到数据库 windows系统 source d:/tables.sql; Linux系统 source /home/soft/桌面/tables.sql; 导入完成后 测试查询 show tables; 查询出两个表 emp和dept select * from emp; 里面会有一堆数据 is null 和 is not null 当查询字段的值为空值时 不能用等号进行判断,使用is 1. 查询没有上级领导的员工信息; select * from emp where ma