困惑
20190927
- 合并两条查询语句
- 第一条
use mydatabase;
select max(date_id) as max_date_id from my_date_table
where date_int < 20190927 and day_of_week = 7;
- 第二条
use mydatabase;
select week_of_year from my_date_table where date_id = max_date_id ;
- 合并
use lion;
select ddd.week_of_year from my_date_table ddd
inner join
(select max(ddd2.date_id) as max_date_id from my_date_table ddd2 where
date_int < 20190927 and ddd2.day_of_week = 7) maxday
on ddd.date_id = maxday.max_date_id
- 有没有简单的方法?