We help IT Professionals succeed at work.
Get Started

Code to query time at 00:00:00.0 vs current time

browneye9000
browneye9000 asked
on
368 Views
Last Modified: 2012-05-05
Disclaimer:  I am an SQL idiot.  Everything I have done is copy and paste with the help of others.

I am currently using SQL to query a database located in one application called InfoPlus21 ( a process control data historian) to another application called Northwest Analytical (a statistical process control application).

This is the code I have so far.

SELECT ts, avg  FROM aggregate  WHERE name='T2EG:AE143201.PV'  AND ts > getdbtime-500:00:00.0  AND period = 1:00

The ts stands for time stamp.  The problem is that when I run the query the data is pulled starting with the getdbtime (I guess this is the current time) and then goes back for 500 1 hr intervals.

For reasons that are much too detailed to write here I need for the first time stamp to be started at the 00:00:00.0 time.  I gues this may be achieved by taking the getdbtime and then going back to the first occurance of 00:00:00.0 but I'm not sure how to do this.

Please feel free to ask questions if you need more clarification but keep my disclaimer in mind.
Comment
Watch Question
CERTIFIED EXPERT
Top Expert 2012
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE