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 7894815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:29:26+00:00 2026-06-03T07:29:26+00:00

I read berfore SQL Count for a Date Column and SQL to get count

  • 0

I read berfore SQL Count for a Date Column and SQL to get count by date but these does not point my problem.

I have the following table records (the table has only two columns)

| VALUE   | TIME               |
--------------------------------
| test    | 04.05.2012 11:46:46|
| test2   | 04.05.2012 11:46:49|
| test3   | 06.05.2012 11:47:46|
| test2   | 05.05.2012 11:47:46|
| test    | 04.05.2012 11:51:46|

I want to display like:

| VALUE   | COUNT   | NEWTIME  |
--------------------------------
| test    | 2       |04.05.2012|
| test2   | 1       |04.05.2012|
| test2   | 1       |05.05.2012|
| test3   | 1       |06.05.2012|

I counted VALUE by using day as datepart of TIME like:

select datepart(d, TIME), count(VALUE) from table1
group by datepart(d, TIME)

How to get also the additional NEWTIME column ? It is possible in SQL Server 2005 ?

Thank you

  • 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-03T07:29:27+00:00Added an answer on June 3, 2026 at 7:29 am
    select VALUE,
           count(*) as COUNT,
           dateadd(day, datediff(day, 0, TIME), 0) as NEWTIME
    from YourTable
    group by VALUE, dateadd(day, datediff(day, 0, TIME), 0)
    

    SE-Data

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

Sidebar

Related Questions

I have read several posts about the configuration manager in VS2010 (or before) but
I have read many questions and answers, but I couldn´t find solution for my
I am trying to run following code: with open('file.sql') as sqlFile: sql = sqlFile.read()
I read the following statement: SQL Server doesn’t write data immediately to disk. It
Trying to completely understand SQL Server Isolation Levels - notably REPEATABLE READ. I have
Before I get into describing by problem I'd like to point out I am
I have a SQL Server DB with the following tables and relationships: Jobs which
I have to insert some data periodically in my SQL Server database. But the
Read on before you say this is a duplicate, it's not. (as far as
Ok, so read my question before you respond. I have a c# project that

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.