Comparing 2 tables dates

Database
Enthusiast

Comparing 2 tables dates

Hi I'm having problem comparing 2 tables together they only have one column in common which is the log date. 1 table's data stopped some time in 2018 and the new table picked up some time before that I'm trying to find when the dates overlap 


Accepted Solutions
Highlighted
Teradata Employee

Re: Comparing 2 tables dates

Like this :

select logdate from table1
intersect
select logdate from table2;

If you need all information from let's say table1, you can use the exists operator :

select t1.*
  from table1 as t1
 where exists (select null
                 from table2 as t2
                where t2.logdate = t1.logdate);
1 ACCEPTED SOLUTION
3 REPLIES 3
Teradata Employee

Re: Comparing 2 tables dates

Hi Blazio,

You can use the intersect operator.
Enthusiast

Re: Comparing 2 tables dates

Hi Walder,

 

how would that look ?

Highlighted
Teradata Employee

Re: Comparing 2 tables dates

Like this :

select logdate from table1
intersect
select logdate from table2;

If you need all information from let's say table1, you can use the exists operator :

select t1.*
  from table1 as t1
 where exists (select null
                 from table2 as t2
                where t2.logdate = t1.logdate);