Difference between revisions of "SQL Date operators"

From Recital Documentation Wiki
Jump to: navigation, search
(Products)
 
Line 30: Line 30:
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
EXEC SQL
+
SELECT account_no, ord_date – rec_date as "Delivery Delay";
SELECT account_no, ord_date – rec_date as "Delivery Delay"
+
FROM accounts;
FROM accounts
+
ORDER BY account_no
ORDER BY account_no;
+
 
</code>
 
</code>
  

Latest revision as of 15:47, 5 July 2011

Purpose

Date operators


Syntax

<expression1> operator <expression2>[ operator <expression3>…]


See Also

INSERT, SQL OPERATORS, SELECT, UPDATE


Description

Operators used with Date expressions and Date/Numeric expressions:


Operator Expression1 Expression2 Operation
+ Date Numeric Adds the <expression2> number of days to the date and returns a date
- Date Numeric Subtracts the <expression2> number of days from the date and returns a date
- Date Date Returns a numeric signifying the number of days between the two dates. If <expression2> is later, a negative number is returned


Example

SELECT account_no, ord_date – rec_date as "Delivery Delay";
FROM accounts;
ORDER BY account_no


Products

Recital, Recital Server