Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003

    Unanswered: How to get the in Quarterly

    Hi All,

    I want to select the data from the table in Quarterly
    i have the following query but it is suming all the
    months and giving
    in following query i want to show sum of 01 to
    03months in row and o4 to 06 in one
    that if i give 200101 to has to give me 4 to do that..

    select CONVERT(CHAR(4),period,112), sum(composite)
    from cdh_price_gap
    where CONVERT(CHAR(6),period,112) between '200101' and
    group by CONVERT(CHAR(4),period,112)
    order by CONVERT(CHAR(4),period,112)

    i used to convert to compare the date in this formate
    200101 thats it...


  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    select cast( (month(period)+2) / 3 as integer ) as quarter
    , sum(composite)
    from cdh_price_gap
    group by cast( (month(period)+2) / 3 as integer )


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts