回覆列表
  • 1 # 使用者4243767351955

    sqlserver:

    select convert(varchar(7),dateadd(mm,-t.number,getdate()),120)

    from

    (select number from master..spt_values where type="P") t

    where year(dateadd(mm,-t.number,getdate()))=year(getdate())

    order by convert(varchar(7),dateadd(mm,-t.number,getdate()),120)

    oracle:

    select to_char(add_months(sysdate, -t.rn), "yyyy-mm")

    from dual a, (select rownum - 1 rn from dual connect by rownum

    where to_char(add_months(sysdate, -t.rn), "yyyy") =

    to_char(sysdate, "yyyy")

    order by to_char(add_months(sysdate, -t.rn), "yyyy-mm")

  • 中秋節和大豐收的關聯?
  • 能讓一個12歲的女孩感動到哭的表白情書?