$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;
TP6 数组查询 收集整理
最新推荐文章于 2025-06-06 16:14:11 发布
该段代码展示了一段SQL查询,用于从notice表中选取特定条件的数据。主要条件包括:publish_status为3,company_id为0,is_display为1,notice_type不等于0且不为空。查询结果按release_time降序和notice_id降序排列。最终查询结果包含了notice_id和notice_type两个字段。
1462

被折叠的 条评论
为什么被折叠?



