gpt4 book ai didi

sql - 找出丢失的日期

转载 作者:行者123 更新时间:2023-12-04 14:09:25 28 4
gpt4 key购买 nike

我使用 SQL Server 2008R2,我需要找出丢失的日期。

 ID College  Dept   JoiningDate
1 SAEC CSE 1/2/2008
2 MSEC EEE 4/2/2008
3 GOV ECE 8/2/2008
4 JKP CSE 9/2/2008
5 VLM CSE 10/2/2008
6 PTR CSE 13/2/2008

输出

JoiningDate
2/2/2008
3/2/2008
5/2/2008
6/2/2008
7/2/2008
11/2/2008
12/2/2008

最佳答案

我已经给你了same type question link在评论中,如果您仍然感到困惑,可以按以下方式检查

;with d(date) as (
select cast('2/1/2008' as datetime)
union all
select date+1
from d
where date < '2/13/2008'
)

select d.date CDate
from d
left join CollegeDate t
on t.JoiningDate = d.date
WHERE ID is null
order by d.date

SQL FIDDLE LINK

关于sql - 找出丢失的日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15901645/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com