SQL裡怎麼查詢兩個固定日期的資訊

時間 2022-09-01 12:20:12

1樓:我要註冊和登入

select * from customer where customer_birthday = '1999-08-09' or customer_birthday = '1999-09-08';

或:select * from customer where customer_birthday in ( '1999-08-09', '1999-09-08');

或:select * from customer where customer_birthday = '1999-08-09'

union all

select * from customer where customer_birthday = '1999-09-08';

當然如果需要資料型別轉化,參見qsc800528様 的回答。

2樓:匿名使用者

select *from 人員表 where convert(varchar(10),出生日期,120) in('1999-08-09', '1999-09-08' )

SQL中兩個日期的查詢語句怎麼寫

1 建立測試表,create table test date id int,v date date 2 插入測試資料 insert into test date values 1,str to date 2016 01 02 y m d insert into test date values 2,...

sql裡日期怎麼加減,sql查詢中日期加減的問題

datediff 返回跨兩個指定日期的日期邊界數和時間邊界數,語法 datediff datepart startdate enddate 用 enddate 減去 startdate 注 datepart 指定應在日期的哪一部分計算差額的引數,其日期相減時,只關注邊界值,例select dated...

sql表中同時查詢兩個count的sql語句

可以有兩種解決方法。方法1 select name count 1 as 總題數 sum case when statu 1 then 1 else 0 end as 稽核題數 from question group by nme 方法2 select s.總題數,s.稽核題數,s.name fro...