如何比较查询中同一字段中的值?

时间:2015-10-17 09:36:54

标签: sql ms-access access-vba

我有一张桌子' table1'如下。我想在状态字段中找到介于两个L之间的所有H.上述标准的输出应为03/07 / 15,08 / 07/15和09/07/15。我该如何解决这个问题?

date      Status
01/07/15    A
02/07/15    L
03/07/15    H
04/07/15    L
05/07/15    H
06/07/15    A
07/07/15    L
08/07/15    H
09/07/15    H
10/07/15    L

1 个答案:

答案 0 :(得分:-1)

试试这个

select date, status from table1 where status = 'H' and date  between (select MIN(date) from table1 where status = 'L') and (select MAX(date) from table1 where status = 'L')
相关问题