如何将3个日期更新为一个唯一的行 [英] How do I update 3 dates into one unique row

查看:78
本文介绍了如何将3个日期更新为一个唯一的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好b $ b

我有一张电子表格,其中有成员进行体检和日期。在电子表格中,一些成员访问次数超过1次(取决于他们的年龄)



我有一个电子表格,每个成员有3个访问日期,通用构成ID为唯一标识符。到目前为止,我能够更新最早和最新的访问..

Hi
I have a spreadsheet which has members who went for a physical checkup and the dates. In spreadsheet, some of the members had more than 1 visit (depending on their ages)

I have a spreadsheet that has 3 visit dates for each member, with universalmemberID as the unique identifier. So far I was able to update the earliest and the latest visit..

select distinct universalmemberID, min([first service date])as Minvisit
Into #Minvisit3
From #linked
where submeasure = '3 Visits' and event <> 'Continuous_Enrollment'
Group by universalmemberID

select distinct universalmemberID, max([first service date])as Maxvisit
Into #Maxvisit3
From #linked
where submeasure = '3 Visits' and event <> 'Continuous_Enrollment'
Group by universalmemberID



现在我必须更新第二个日期,这是最早的日期之间分钟和最新的最大值有什么方法可以在其他查​​询时做一个简单的案例吗?请帮忙!







添加标签。

[/ Edit]

推荐答案

你可以试试像



You could try something like

Select ID, Min(Date), Max(Date)
From Table
Group By ID



这会得到你的日期'进入临时表需要如此


This gets the dates you DON'T into a temp table want so

Select ID,Date
from Table T
where not exists (select * from TempTable where ID = T.ID and Date != T.Mindate and date != T.MaxDate)


这篇关于如何将3个日期更新为一个唯一的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆