SQL多条件查询语句

2022-08-12 教育 76阅读
select * from tab_name where 组号='001组' and to_char(日期,'yyyy-mm-dd')='2013-04-15' and 姓名1='小王'
union all
select * from tab_name where 组号='001组' and to_char(日期,'yyyy-mm-dd')='2013-04-15' and 姓名2='小王'
union all
select * from tab_name where 组号='001组' and to_char(日期,'yyyy-mm-dd')='2013-04-15' and 姓名3='小王'
union all
select * from tab_name where 组号='001组' and to_char(日期,'yyyy-mm-dd')='2013-04-15' and 姓名4='小王'

或者是:
select * from tab_name where 组号='001组' and to_char(日期,'yyyy-mm-dd')='2013-04-15' and 姓名1='小王' or 姓名2='小王' or 姓名3='小王' or 姓名4='小王'
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com