Q&A

  • 오라클에서 월별,요일별 쿼리로 검색하는법아시는분?
오라클을 쓰구 있는데염......

월별,분기별,요일별,년도별로 각 상품들의 총판매량을 구할려구하는데염.....

오라클에서 어케 하는지 아시는분 있으신가염.....

몇일째 하구있는뎅 정말 모르겠네염....

오라클에서는 따로 함수같은게 없나염??

그럼...일일이 수작업으루 해야하나염....ㅜㅜ

1  COMMENTS
  • Profile
    특전사 2001.08.20 23:10
    //아래쿼리는 남여별 월별로 매월 퇴사한인원 구하는 sql임.

    //sum, decode, group by를 응용하면 해결될 겁니다...

    //그럼 수고하십시오..



    select sex, sum(decode(substr(outdate,5,2),'01','1','0')) month_1,

    sum(decode(substr(outdate,5,2),'02','1','0')) month_2,

    sum(decode(substr(outdate,5,2),'03','1','0')) month_3,

    sum(decode(substr(outdate,5,2),'04','1','0')) month_4,

    sum(decode(substr(outdate,5,2),'05','1','0')) month_5,

    sum(decode(substr(outdate,5,2),'06','1','0')) month_6,

    sum(decode(substr(outdate,5,2),'07','1','0')) month_7,

    sum(decode(substr(outdate,5,2),'08','1','0')) month_8,

    sum(decode(substr(outdate,5,2),'09','1','0')) month_9,

    sum(decode(substr(outdate,5,2),'10','1','0')) month_10,

    sum(decode(substr(outdate,5,2),'11','1','0')) month_11,

    sum(decode(substr(outdate,5,2),'12','1','0')) month_12

    from ( select sex, outdate,

    months_between(to_char(to_date(outdate)+1,'yyyymmdd'),indate)/12 month

    from insabase

    where ishold = '3'

    and companyid = '1010') a

    where a.month <= 0.3

    and sex = '1'

    group by sex







    노력중인초보 wrote:

    > 오라클을 쓰구 있는데염......

    > 월별,분기별,요일별,년도별로 각 상품들의 총판매량을 구할려구하는데염.....

    > 오라클에서 어케 하는지 아시는분 있으신가염.....

    > 몇일째 하구있는뎅 정말 모르겠네염....

    > 오라클에서는 따로 함수같은게 없나염??

    > 그럼...일일이 수작업으루 해야하나염....ㅜㅜ