Link to home
Start Free TrialLog in
Avatar of jjrr007
jjrr007

asked on

Date & Time Teradata

I have two tables that I need to join together.  Each of the two tables has a date and a time column.  How do I combine the date and time columns together so I can join the tables?

Just to illustrate:
Table 1
DateColumn                  TimeColumn
2010-01-01                   80000
...

Table 2
DateColumn                  TimeColumn
2010-01-01                   80100
... I need join Table 1 to Table 2 if the date/time is after (1/1/2010 8:00 AM).  
Avatar of dportas
dportas

SELECT *
FROM table1, table2
WHERE table1.DateColumn = table2.DateColumn
AND table1.TimeColumn = table2.TimeColumn
AND (table1.DateColumn > '2010-01-01'
         OR (table1.DateColumn = '2010-01-01' AND table1.TimeColumn > '08:00:00')
        );

(untested)
Avatar of jjrr007

ASKER

The time would need to be considered as part of the date.  
ASKER CERTIFIED SOLUTION
Avatar of jjrr007
jjrr007

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial