mysql 查询某个字段不为空(附thinkphp写法)

时间:2022-09-17 16:15:23

1.如果要写某个字段不为空,mysql的表达式应为:

假设字段为:door_open_api_key,

那么:door_open_api_key is  not null AND door_open_api_key != ""


2. thinkphp中应写为

        $Reserve_system = M('Reserve_system');
        $where = array();
        $where['door_open_api_key'] = array('exp',' is not null AND door_open_api_key != ""');
        $reserve_systems = $Reserve_system->where($where)->select();