【发布时间】:2020-11-24 04:07:13
【问题描述】:
我有一张名为“医疗报告”的表格 我需要在处方中选择最小日期、最大日期以及特定帐号、代码的相应活动状态
Accountnumber code prescriptionwritten. Active
101 201 2019-10-21 0
101 201 2020-03-24 0
101 201 2020-05-25 1
101 202 2019-10-21 0
101 202 2020-06-20 1
请帮忙查询sql。
输出:
101 201 2019-10-21 0
101 201 2020-05-25 1
101 202 2019-10-21 0
101 202 2020-06-20 1
【问题讨论】:
-
请提供您预期的输出 int 表格式
-
类似
select accountnumber,code,max(presriptionwritten),active from table group by accountnumber,code,active。
标签: sql