一个字段同时满足多个条件的查询

2023年 4月 20日 14.4k 0

所以需要一些特殊处理。 复制代码 代码如下: SELECT * FROM news_extinfo where (ExtID = 1 and OptionValue = 0) or (ExtID = 2 and OptionValue = 0 ) or (ExtID = 3 and OptionValue = 0 ) group by NewsID having count(*)=3 此处 c

所以需要一些特殊处理。 复制代码 代码如下: SELECT * FROM news_extinfo where (ExtID = 1 and OptionValue = 0) or (ExtID = 2 and OptionValue = 0 ) or (ExtID = 3 and OptionValue = 0 ) group by NewsID having count(*)=3 此处 count(*) = 3 表示的意思是 在查询的结果中,只查出按group 分组之后,每个组的有3条数据的结果集

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论