首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >根据描述字段获取日期值

根据描述字段获取日期值
EN

Stack Overflow用户
提问于 2019-08-29 00:32:52
回答 1查看 28关注 0票数 0

我有一个名为actlog .I的表,其中包含每个特定案例的活动信息。现在我需要获取案例从一个团队转移到另一个团队的日期。

下面是示例。在这里,我需要获取案例从1级转移到2级的日期,即2/11/2018

代码语言:javascript
复制
Case    Team    Date    Agent   Summary
123 Level 2     2/13/2018   Ravi    Working on the case
123 Level 2     2/12/2018   Ravi    Working on the case
123 Level 2     2/11/2018   Ravi    Transferred to L2 : Agent Ravi
123 Level 1 2/10/2018   Ram Working on the case
123 Level 1 2/10/2018   Ram Working on the case
123 Level 1 2/10/2018   Ram Working on the case
123 Level 1 2/10/2018   Ram Working on the case
EN

回答 1

Stack Overflow用户

发布于 2019-08-29 00:35:11

使用lag()

代码语言:javascript
复制
select t.*
from (select t.*, lag(team) over (partition by case order by date) as prev_team
      from t
     ) t
where prev_team <> team;

我更喜欢根据实际数据。您还可以尝试依赖于summary并使用like

代码语言:javascript
复制
select t.*
from t
where summary like 'Transferred to%';
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57696688

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档