列名acct_month ,acct_year,表名acct_vouch查询最大、小月,最小月要对应最小年select min(acct_month) as start_month from acct_vouch where acct_year=(select min(acct_year) from acct_vouch) select max(acct_month) as cur_month from acct_
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/21 06:35:59
列名acct_month ,acct_year,表名acct_vouch查询最大、小月,最小月要对应最小年select min(acct_month) as start_month from acct_vouch where acct_year=(select min(acct_year) from acct_vouch) select max(acct_month) as cur_month from acct_
列名acct_month ,acct_year,表名acct_vouch查询最大、小月,最小月要对应最小年
select min(acct_month) as start_month from acct_vouch where acct_year=(select min(acct_year) from acct_vouch)
select max(acct_month) as cur_month from acct_vouch where acct_year=(select max(acct_year) from acct_vouch)
select max(acct_year)as cur_year,min(acct_year)as start_year from acct_vouch 我只会分3句写 求高手一句sql查询 最大最小月
列名acct_month ,acct_year,表名acct_vouch查询最大、小月,最小月要对应最小年select min(acct_month) as start_month from acct_vouch where acct_year=(select min(acct_year) from acct_vouch) select max(acct_month) as cur_month from acct_
拿去直接可以用
select t.cur_year as 最大年份,t.start_year as 最小年份,t.am as 最大月份,x.xm as 最小月份 from (
select max(acct_year)as cur_year,min(acct_year)as start_year,MAX(acct_month) as am from acct_vouch) t ,(
select min(acct_year)as cur_year,min(acct_year)as start_year,min(acct_month) as xm from acct_vouch) x