If we give this year and weekid like 201106 we have to find last week data?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rkboss9
    New Member
    • Feb 2012
    • 2

    If we give this year and weekid like 201106 we have to find last week data?

    Hi,
    if the we give the data retrieval given in yyyyww from in which yyyy= year and ww=week ex:201206
    i have to retrive the last week monday(frist_da y) sales data and last sunday(last_day ) data ex:201205.

    when we give the same any week in the year , we have to retrive last week monday(frist_da y) and sunday(last_day )
    we have to find.

    pls send the logic.

    Thanks in Advance.
    RK
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    The logic is simple, calculate the week number of the sale by taking the dayofyear and integer dividing by 7 and adding 1 (I'm assuming you have a sale date field that is a date time data type). Then you append that to the year. Finally, you compare it to your parameter.

    Comment

    • rkboss9
      New Member
      • Feb 2012
      • 2

      #3
      can you write that query .
      im not understanding that, im new for db2.

      i have a columns like sales_day and week id-yyyyww(201206), and weekday

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Sorry, I don't give code out unless the poster shows they've attempted to solve the problem.

        Comment

        Working...