Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8799195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:15:41+00:00 2026-06-14T00:15:41+00:00

the following statement: group by datepart(wk, createdon) Groups the selected rows according to the

  • 0

the following statement:

group by datepart(wk, createdon)

Groups the selected rows according to the week in which they fall. My select statement shows the following:

SELECT 
    datepart(wk, createdon) week,

How do I display the actual datetime of the week(“12-10-2012”), instead of the number (“12”)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:15:43+00:00Added an answer on June 14, 2026 at 12:15 am

    If I understand you correctly, you’re wanting to group by week but also return the full datetime. You must include the selected fields in aggregate columns.
    Thusly should work:

    SELECT DATEPART(wk, createdon) week, createdon
    FROM TableName
    GROUP BY DATEPART(wk, createdon), createdon
    

    Works on MSSQL2008R2

    Edit:
    As the OP seems to want the starting date of the week, SO has the answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following SQL statement: SELECT invoice.customer_name, invoice.customer_id, invoice.shop_location, sum(invoice.cost) FROM invoice GROUP BY
The following SELECT statement select * from messages where receiverID = '5' group BY
When I run the following SQL statement: SELECT MAX(SUM(TIME)) FROM downloads GROUP BY SSN
I have the following select statement which works fine SELECT status_id, COUNT(status_id) As total
I have the following sql statement: select val, count(*) as tally from sometable group
Using the following SQLite statement: SELECT Customer, SUM(OrderAmount) AS TotalOrder FROM OrdersTable GROUP BY
I have following SQL statementL: select DATE(bla), count(*) from tableA group by DATE(bla) UNION
i have many to many relationship between employee and group. following linq statement int[]
I have the following Join statement : SELECT DISTINCT dn.fname, dn.lname,w.websit,q.qual,q.year,q.postqual,p.pnumber,a.accred,n.nspecial FROM cur_doctor_names dn
See the following SQL statement: SELECT datediff(d, MAX(invoice.date), Now) As Date_Diff , MAX(invoice.date) AS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.