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. Data Group on Week:

Data Group on Week:

Scheduled Pinned Locked Moved Database
4 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.
  • S Offline
    S Offline
    Shahzad Aslam
    wrote on last edited by
    #1

    Hi i have following fields in a Table i want to group on month and week plz help me to build query. Userid,Value,Date,RefNo,Type now i have month function but i want to group on week. so what will be the query? Regards, Shahzad Aslam Software Engineer

    H B 2 Replies Last reply
    0
    • S Shahzad Aslam

      Hi i have following fields in a Table i want to group on month and week plz help me to build query. Userid,Value,Date,RefNo,Type now i have month function but i want to group on week. so what will be the query? Regards, Shahzad Aslam Software Engineer

      H Offline
      H Offline
      Harini N K
      wrote on last edited by
      #2

      Hi Query will be Select datename(ww, getdate()) - which will give you week number of the given date.

      Harini

      1 Reply Last reply
      0
      • S Shahzad Aslam

        Hi i have following fields in a Table i want to group on month and week plz help me to build query. Userid,Value,Date,RefNo,Type now i have month function but i want to group on week. so what will be the query? Regards, Shahzad Aslam Software Engineer

        B Offline
        B Offline
        Bad Programmer
        wrote on last edited by
        #3

        Try this out with ur values in place of ''08-03-2006' ------------------------------------------------------ select *,datename(mm,('08-03-2006')) as mnthName, datename(dw,('08-03-2006')) as wkName group by mnthName, wkName !!Hope so it should work :-D Bala, HeroITES, Gurgaon(India)

        S 1 Reply Last reply
        0
        • B Bad Programmer

          Try this out with ur values in place of ''08-03-2006' ------------------------------------------------------ select *,datename(mm,('08-03-2006')) as mnthName, datename(dw,('08-03-2006')) as wkName group by mnthName, wkName !!Hope so it should work :-D Bala, HeroITES, Gurgaon(India)

          S Offline
          S Offline
          Shahzad Aslam
          wrote on last edited by
          #4

          Thanx! its working. Shahzad Aslam Software Engineer

          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