//(1) 创建表 CREATE TABLE table_date (DATE1 DATETIME);
//(2) 插入数据
INSERT INTO table_date VALUES('2023-04-15'); INSERT INTO table_date VALUES('2023-04-16'); INSERT INTO table_date VALUES('2023-04-17'); INSERT INTO table_date VALUES('2023-04-18');
//(3) 日期奇偶分列
with tmp as ( select a.*,row_number() over (order by DATE1) as rw from table_date a) select * from (select a.*,row_number() over () as rnw from tmp a where a.rw%2=1) a left join (select b.*,row_number() over ()as rnw from tmp b where b.rw%2=0) b on a.rnw=b.rnw ;
// 执行结果