I have a table with three columns (City_Code | Start_Date | End_Date).
Suppose I have the following data:
New_York|01/01/1985|01/01/1987
Paris|02/01/1987|01/01/1990
San Francisco|02/01/1990|04/01/1990
Paris|05/01/1990|08/01/1990
New_York|09/01/1990|11/01/1990
New_York|12/01/1990|19/01/1990
New_York|20/01/1990|28/01/1990
I would like to receive a date during which someone lived in the last city of his residence. In this example, this is New_York (09/01 / 1990-28 / 01/1990), using only sql. I can get this period by manipulating data using java, but is it possible to do this with simple sql?
Thanks in advance
nthed source
share