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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:40:26+00:00 2026-05-26T22:40:26+00:00

i have a table with columns: ID_LOG (this is the pk) | TS (type=datetime)

  • 0

i have a table with columns:

ID_LOG (this is the pk) | TS (type=datetime) | VALUE (type=double) | ID_CHANNEL (unique).

This table logs values form different channels every 15 minutes. The values are taken from some counters so they are always increasing.
Now i want to get the differences between maximum value and minimum value (so the net difference) of every day of last year of a specific channel.
Something like:

SELECT MAX(T1.value) - MIN(T1.value), T1.ts
FROM dbo.[LOG] as T1
WHERE T1.ts > DATEADD(year, -1, GETDATE()) and
T1.ID_CHANNEL=x      //[x being the channel i want]
GROUP BY SOMEDATEFUNCITON(T1.ts) //[SOMEDATEFUNCTION is the function that groups results by date not taking in consideration the time of timestamp but only year-month-day]

I don’t care about efficency as i will do this query only once or twice per year.
Is this possible? And how you’d do?
Thanks a lot!

  • 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-05-26T22:40:26+00:00Added an answer on May 26, 2026 at 10:40 pm
    SELECT convert(char(10), creationDate, 120), COUNT(custID) AS totalRegistered
    FROM dbo.SecureSignInUser
    WHERE (CreationDate BETWEEN '11/1/2004' AND '11/30/2004'
    

    GROUP BY convert(char(10), creationDate, 120)

    check this for your date format ..
    http://msdn.microsoft.com/en-us/library/ms187928.aspx

    cast/ convert your function return date value format according to your database date format.

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

Sidebar

Related Questions

I have a table of Logs with the columns name, duration, type, ref_id .
I have a table with columns 'id', 'name', 'value', 'uniqueConst' in both databases. Now
I have a table called Table with columns: ID (int, primary key, clustered, unique
Let's say I have a table Foo . This table has the columns ID
I have this table where columns correspond to names: i.e. 11 = first, 12
I have a table with columns ID, DateStamp and the ID need not be
If I have a table with columns id , name , score , date
I have a table Player with columns id, name, wins, games_played. I mapped it
Let's say I have a table tbl with columns id and title . I
I have a table of 3 columns: AuthorID (id can be repeated) JournalName (name

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.