Discussion:
SQL Query help
(too old to reply)
Mike Arney
2017-10-23 19:07:37 UTC
Permalink
I have a MSSQL table with the following columns and data types:

Topic -- nvarchar
Payload -- numeric
Timestamp -- datetime
id -- int


Here is some example data:

Topic Payload Timestamp id
STG/A/CycleStart 0 2017-10-23 15:37:56.697 1651
STG/A/CycleStart 0 2017-10-23 15:37:55.670 1650
STG/A/CycleStart 0 2017-10-23 15:37:55.193 1649
STG/A/CycleStart 0 2017-10-23 15:37:54.687 1648



The Timestamp column's default value is set to: (getutcdate())


I need to add the TIMESTAMP column for the last 24 hours where TOPIC = 'STG/A/CycleStart' and PAYLOAD = 1

I also need this time in seconds.

Any help would be greatly appreciated.

Thanks,
Mike
t***@gmail.com
2017-11-14 18:04:22 UTC
Permalink
Post by Mike Arney
Topic -- nvarchar
Payload -- numeric
Timestamp -- datetime
id -- int
Topic Payload Timestamp id
STG/A/CycleStart 0 2017-10-23 15:37:56.697 1651
STG/A/CycleStart 0 2017-10-23 15:37:55.670 1650
STG/A/CycleStart 0 2017-10-23 15:37:55.193 1649
STG/A/CycleStart 0 2017-10-23 15:37:54.687 1648
The Timestamp column's default value is set to: (getutcdate())
I need to add the TIMESTAMP column for the last 24 hours where TOPIC = 'STG/A/CycleStart' and PAYLOAD = 1
I also need this time in seconds.
Any help would be greatly appreciated.
Thanks,
Mike
so you need the time elapsed since the timestamp in seconds?

Loading...