sql - 如何根据 SQL Server 中的条件派生新列?
问题描述
我有下表。
我希望根据这些条件编写一个 SQL 查询:其中阶段是筛选,状态是状态=(选择/拒绝/删除)的数据(实际日期)的最小值作为面试日期
解决方案
尝试这个
select
t1.stage, t1.status, t2.data
from
table as t1
inner join
(select
stage, min(data) as data
from
table
group by
stage) as t2 on t1.stage = t2.stage and t1.data = t2.data
推荐阅读
- macos - 如何使用 io.open 在 Lua/MacOS 中访问 .suit 字体文件?.ttf/.otf 工作正常,西装不行
- python - Python 无法安装 Box2D swig.exe 失败,错误代码为 1
- angular - Angular 在对象中使用服务或在构造函数中使用服务创建对象
- bash - 如何针对不同的参数和值自动化和概括以下命令 - 当用于 bash 脚本时?
- java - JNDI 数据源:从 Weblogic 迁移到 Jboss 7
- php - 在亚马逊上使用 PHP 删除托管区域资源记录集
- python - 从熊猫数据框列中提取多个单词到同一列
- rust - 是否可以使用 Clap 配置未知大小的参数组?
- java - Java:从多数组中提取索引 src
- python-3.x - Cloudfare 中间件递归绕过保护