SQL Access查询第一日期和截止日期为每个系列(C#.NET)

SQL Access查询第一日期和截止日期为每个系列(C#.NET)

问题描述:

enter image description hereSQL Access查询第一日期和截止日期为每个系列(C#.NET)

,我需要选择的第一个日期和最后日期各系列

我有使用子查询

以下解决方案
select t1.person_id, 
     t1.date as start_date, 
     (
      select max(date) 
      from your_table t2 
      where t2.date > t1.date and t2.date < ALL(
        select date 
        from your_table t3 
        where t3.first = 1 and t3.date > t1.date) 
     ) as end_date 
from your_table t1 
where t1.first = 1 
+0

这是行不通的,因为它不是一个sql访问c#程序访问(它将与SQL服务器一起工作) – Fawzidi