display records between two days week by week

  • I have to display data between two dates week by week. It should display Monday to Sunday.

    TableA

    Sno Sname Date

    1 A 04/01/09

    2 B 04/02/09

    3 C 04/03/09

    4 D 04/04/09

    5 E 04/05/09

    6 F 04/06/09

    7 G 04/07/09

    8 H 04/08/09

    9 I 04/09/09

    10 J 04/010/09

    11 K 04/011/09

    Example: I have to pass two variables to stored procedure. They are @startdate and @enddate.

    Exec Stprocedure ‘04/01/09’ ‘04/11/09’

    It should display

    1st week Details

    Sno Sname Date

    1 A 04/01/09

    2 B 04/02/09

    3 C 04/03/09

    4 D 04/04/09

    5 E 04/05/09

    2nd week Details

    Sno Sname Date

    6 F 04/06/09

    7 G 04/07/09

    8 H 04/08/09

    9 I 04/09/09

    10 J 04/010/09

    11 K 04/011/09

    Because this month started with Wednesday, that’s why it should display wed to sun for 1st week and Monday to Sunday for 2nd week.

    It should display for all the weeks between two dates.

  • May I ask why you need to do this in the stored procedure? This is something that really should be done by the front end application or report, not on the database side.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply