473,499 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

subtracting 2 datetime values

2 New Member
I need to subtract 2 datetime values.

The values are from the same view table but 2 different rows.

The points in the table are Alarm points which are generated via an after hours push button for air conditioning. The first point is the time the alarm is first initiated and the second is the time the alarm is disabled after the after hours timer disables.

Below are the queries which I am using to retrieves each value presently.

Expand|Select|Wrap|Line Numbers
  1. SELECT LastAlarmDetailsByTime.originalAlarmTime
  2. FROM         LastAlarmDetailsByTime
  3. WHERE      (lan = 20) AND (os = 41) AND (theModule = N'i1') AND (AlarmCode = N'DI=1')
  4. ORDER BY originalAlarmTime DESC
Expand|Select|Wrap|Line Numbers
  1. SELECT LastAlarmDetailsByTime.originalAlarmTime
  2. FROM         LastAlarmDetailsByTime
  3. WHERE      (lan = 20) AND (os = 41) AND (theModule = N'i1') AND (AlarmCode = N'CDI1')
  4. ORDER BY originalAlarmTime DESC
Oct 6 '11 #1
2 2043
ck9663
2,878 Recognized Expert Specialist
What is the column that link this two? Equipment ID perhaps? And your query is almost identical, too. Do you just need the value from the previous row after sorting by date?


~~ CK
Oct 6 '11 #2
tomcbr
2 New Member
I am a little unsure what you mean by “column that links the two”
Basically I need to subtract the first query’s "originalAlarmTime" from the second query’s "originalAlarmTime".

Sorry for my ignorance, I am very new to this as I am an electrician working with building management systems.
Oct 6 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
24786
by: Thomas Bartkus | last post by:
MySQL Version 4.0.20 on a Linux server. How does one get the elapsed time between (2) DateTime values? I need the answer to the nearest minute. Is upgrading to Ver 5 with its more robust...
1
1279
by: Shai Zohar | last post by:
We have encountered the following problem with DOT.NET 2003 development environment. Sometimes while debugging, we the environment does not display the values of DateTime variables and fields. ...
2
7728
by: Echo 8 | last post by:
Is there a simple way of compare dates? I am trying to create a list of perishable stock in an inventory that is near or past its expiration date. I've tried telling it to compare a node's value...
1
1319
by: Bruce Vander Werf | last post by:
I need to format a DateTime in the following format: "Mmm dd hh:mm:ss" Where Mmm is the three-letter abbreviation for the month. What's the best way to do this in C#? --Bruce
2
1507
by: Jonesgj | last post by:
Hi, I have connected to a SQL Server table using dataAdapter/Dataset to fill a data grid. On SQL Server a column is a DateTime datatype (its actually a 'LastLogon' column ) and has both Date and...
2
1809
by: Joe Van Meer | last post by:
Hi all, Do dates & time values always get inserted according to the user's main language setting in their browser? Like, if I had an application that somehow relied on comparing dates and...
4
8907
by: David S. Alexander | last post by:
How can I do simple subtraction in an XSLT. I want to read a few attribute values from an XML document, calculate their difference, and transform that value to an attribute in the XML output...
5
2611
by: A.M | last post by:
Hi, I have a datetime value and want to format it to "June 1, 2006" shape. How can I do that? Thank you,
2
20460
by: deepbright | last post by:
I'm having trouble understanding the MySQL docs on how to subtract two DATETIME values. I have two tables that have a DATETIME column. In my SELECT I am doing a JOIN to bring in both sets of rows....
1
8258
by: remya1000 | last post by:
I’m using VB.net 2003 application program. I am trying to do a select statement whereby I'm searching between 2 datetime values that are being stored as datetime. records are stored inside...
0
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5470
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3099
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.