Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Want to get data on weekly basis

Want to get data on weekly basis

Scheduled Pinned Locked Moved Database
data-structureshelp
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VishwaKL
    wrote on last edited by
    #1

    Hi guys, I want to plot a graph that shows weekly data for total year of total number of issues and solved issues. So yearly will have 52 weeks. My financial year will start every year October to next year September end. EX my Financial year 2012-13 Start date will be 01/10/2012 end date will be 30/09/2013. Any help will be appreciated. Thanks and regards Vishwa

    M D 2 Replies Last reply
    0
    • V VishwaKL

      Hi guys, I want to plot a graph that shows weekly data for total year of total number of issues and solved issues. So yearly will have 52 weeks. My financial year will start every year October to next year September end. EX my Financial year 2012-13 Start date will be 01/10/2012 end date will be 30/09/2013. Any help will be appreciated. Thanks and regards Vishwa

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      Look into DATEPART that will give you the week number of the date within the year. Count the issues and group by the week datepart

      Never underestimate the power of human stupidity RAH

      1 Reply Last reply
      0
      • V VishwaKL

        Hi guys, I want to plot a graph that shows weekly data for total year of total number of issues and solved issues. So yearly will have 52 weeks. My financial year will start every year October to next year September end. EX my Financial year 2012-13 Start date will be 01/10/2012 end date will be 30/09/2013. Any help will be appreciated. Thanks and regards Vishwa

        D Offline
        D Offline
        Davidduraisamy
        wrote on last edited by
        #3

        Sum up want ever you want and make group by with datepart.

        V 1 Reply Last reply
        0
        • D Davidduraisamy

          Sum up want ever you want and make group by with datepart.

          V Offline
          V Offline
          VishwaKL
          wrote on last edited by
          #4

          Thank you guys i solved the issue, thank you for your support

          D 1 Reply Last reply
          0
          • V VishwaKL

            Thank you guys i solved the issue, thank you for your support

            D Offline
            D Offline
            Davidduraisamy
            wrote on last edited by
            #5

            ok..Post the Query..

            V 1 Reply Last reply
            0
            • D Davidduraisamy

              ok..Post the Query..

              V Offline
              V Offline
              VishwaKL
              wrote on last edited by
              #6

              SELECT DATEPART(YEAR,trans_date) AS 'Year',DATEPART(wk,trans_date) AS 'Week #',MIN(DATEADD(wk, DATEDIFF(wk,0,trans_date), 0)) AS 'Week date', SUM(COALESCE(debit,0)) AS 'Debits', SUM(COALESCE(credit,0)) AS 'Credits' FROM trans GROUP BY DATEPART(YEAR,trans_date),DATEPART(wk,trans_date)ORDER BY 1,2;

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups