DolphinDB中的context by也支持having,可以按组来来过滤数据
```
select * from t context by SecurityId csort volume desc having rowNo(volume) < volume.size() * 0.25
```
下面一种方法稍微复杂一点,就是先用percentile找到每个股票%75的最大值,然后用字典设定每个股票对应的75%最大值,再用conditionalFilter根据字典设定的值去过滤查找25%目标值:
```
filter = select int(percentile(volume, 75)) as min, max(volume) as max from t group by SecurityId
filterMap = dict(filter.SecurityId, each(pair, filter.min, filter.max))
select * from t where conditionalFilter(volume, SecurityId, filterMap)
```