0

I have a base teradata table. It has 2 dates - from_date and to_date Example Base Table: Student_Address (Blank To_date indicates current date, latest record)

Student Address From_date To_date
A        A1      1/1/2015  6/2/2015
A        A2      6/3/2015     ?

Required view: Student_Address_View Student Address snap_date

when the user specifies

select * from Student_Address where snap_date = '2015-02-10',

it should give first record

when the user specifies

select * from Student_Address where snap_date = '2017-02-10', 

it should give second record

pmv
  • 349
  • 2
  • 20
  • you probably want something like `where date '2015-02-10' between From_date and coalesce(To_date, current_date)` – dnoeth Oct 29 '17 at 23:56
  • Both `snap_date` are same in your example. Kindly clarify your example. – zarruq Oct 30 '17 at 04:13

0 Answers0