0

Currently I am having trouble trying to query a data set that contains multiple records for unique customers. Each row has a start date and end date and the most recent record marked as Most Current and end date as 12/31/9999. I am trying to write a query so that I can return all records that fall on a specific date such as months end (10/31/2018). My goal in Oracle SQL Developer is to type in all records/data on the day 10/31/2017 so the rows with the * are the only ones Id want back. The final outcome is to do this with a much larger file and see the entire year at months end where each person was at based on the month end date for 1 year.

Example Data

4

2 回答 2

0

我认为您想列出截至指定日期的所有最新记录。为此,我只需使用 BETWEEN 条件:

select * from mytable
where date'2017-31-10' between start and end
于 2018-11-16T03:06:51.307 回答
0

你能详细说明你期望的输出吗?我可以看到您正在尝试在这里实现时间功能。如果这符合您的目的,请检查此链接 Oracle temporal 。至于突出显示的记录,您可以像这样在 where 子句中使用简单的条件,并根据需要格式化日期部分:

select * from emp where  endd=to_date('9999/12/31','yyyy/mm/dd')
于 2018-11-15T04:51:42.787 回答