TP6 数组查询 收集整理

该段代码展示了一段SQL查询,用于从notice表中选取特定条件的数据。主要条件包括:publish_status为3,company_id为0,is_display为1,notice_type不等于0且不为空。查询结果按release_time降序和notice_id降序排列。最终查询结果包含了notice_id和notice_type两个字段。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

$where=[];
        $where[]=['publish_status','=',3]; //查询publish_status为3
        $where[]=['company_id','=',0]; //查询company_id 为0
        $where[]=['is_display','=',1]; //查询is_display 为1
        $where[]=['notice_type','<>',0];//查询 不等于0
        $where[]=['notice_type','null',''];//查询 is null
        $where[]=['notice_type','<>','null'];//查询 不等于null
        $where[]=['notice_type','not null',''];//查询 is not null

          $announcement =Db::name('notice')->fetchSql(true)        
            ->where($where)
            ->field('notice_id,notice_type')
            ->order('release_time desc,notice_id desc')->select();
          echo $announcement;die;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值