sql - Getting Table Results based on a Start and End Date using a single date
问题描述
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.
解决方案
我认为您想列出截至指定日期的所有最新记录。为此,我只需使用 BETWEEN 条件:
select * from mytable
where date'2017-31-10' between start and end
推荐阅读
- python - Python3 杀死一个阻塞的线程
- opencv - 创建 PodFile 以包装 OpenCV 4.5.0 的问题 - 安装后没有框架
- python - 如何使用用户输入使程序结束?
- c# - 有没有办法在 Linq2Db 中多次引用编译查询中的相同 CTE?
- blazor - 在 blazor 参考中使用内容时,有人可以帮助解决错误 - 错误 404?
- mysql - 当我试图找到平均值时出现错误
- java - 制作标记“有机体”的递归方法
- reactjs - 为什么我的反应页面没有点击按钮就返回?
- python - 从 Python Google Cloud Function 编写结构化的 json 日志消息
- powershell - 使用powershell删除文本文件中的多个字符串