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

  • SEARCH
  • Home
  • 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 8928555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:27:57+00:00 2026-06-15T08:27:57+00:00

My DateCompleted return the date and the time. If I would like to group

  • 0

My DateCompleted return the date and the time. If I would like to group just by the date and ignore the time. How would I go about this?

SELECT  
  Cast(Jobs.DateCompleted AS VarChar) AS 'DateCompleted',
  SUM(Metrics.GB) AS GB, 
  SUM(Metrics.KB) AS KB
FROM Metrics 
INNER JOIN Jobs ON Jobs.JobId = Metrics.JobId 
INNER JOIN Projects ON Projects.ProjectId = Jobs.ProjectId 
INNER JOIN JobTypes ON JobTypes.JobTypeId = Jobs.JobTypeId
WHERE Jobs.DateCompleted BETWEEN '12/01/2012' AND '12/03/2012' 
GROUP BY Jobs.DateCompleted
  • 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-15T08:27:58+00:00Added an answer on June 15, 2026 at 8:27 am

    If you are using SQL Server, then you can convert the value as a varchar with a format that strips the time:

    SELECT convert(char(10), Jobs.DateCompleted, 120) AS DateCompleted,
      SUM(Metrics.GB) AS GB, 
      SUM(Metrics.KB) AS KB
    FROM Metrics 
    INNER JOIN Jobs 
      ON Jobs.JobId = Metrics.JobId 
    INNER JOIN Projects 
      ON Projects.ProjectId = Jobs.ProjectId 
    INNER JOIN JobTypes 
      ON JobTypes.JobTypeId = Jobs.JobTypeId
    WHERE Jobs.DateCompleted Between '12/01/2012' AND '12/03/2012' 
    GROUP BY convert(char(10), Jobs.DateCompleted, 120)
    

    If you are using SQL Server 2008+, then you can cast the value as a date:

    SELECT cast(Jobs.DateCompleted as date) AS DateCompleted,
      SUM(Metrics.GB) AS GB, 
      SUM(Metrics.KB) AS KB
    FROM Metrics 
    INNER JOIN Jobs 
      ON Jobs.JobId = Metrics.JobId 
    INNER JOIN Projects 
      ON Projects.ProjectId = Jobs.ProjectId 
    INNER JOIN JobTypes 
      ON JobTypes.JobTypeId = Jobs.JobTypeId
    WHERE Jobs.DateCompleted Between '12/01/2012' AND '12/03/2012' 
    GROUP BY cast(Jobs.DateCompleted as date)
    

    Note: I am assuming SQL Server based on your previous tags

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

Sidebar

Related Questions

This is the first time - I'm trying to do something like this -
I am trying to replicate this query using zend framework: SELECT activitytype.description, activity.datecompleted FROM
Hey All! I'm trying to construct a query that is something like this: Where
OK here is what I would like to do. I have an array. What
I have four columns in a table: date entered, time entered, date completed, time
I am using datediff to get the difference between two datetimes: DATEDIFF(hh, CAST(CAST(dbo.QuickLabDump.[Date Entered]
Before LINQ I would have my main application return the results of a SQL
I am joining some tables on a certain criteria. I would like to know
I have a function that looks like this. Function GetNewBatch ( CourseName Varchar2 )
I have 1 table with similar data: CustomerID | ProjectID | DateListed | DateCompleted

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.