根据最后两条记录

时间:2017-09-06 19:14:31

标签: crystal-reports

我的报告需要确定客户的最后两条记录中何时发生了事件。我创建了一个运行总计,并用它来查看每个客户的最后记录。如何仅显示最后两个记录的两个都有此事件的记录?

所以,如果我有:

Customer 1 Record Meets Criteria  
Customer 1 Record Doesn't Meet Criteria  

Customer 2 Record Meets Criteria  
Customer 2 Record Meets Criteria  

Customer 3 Record Doesn't Meet Criteria  
Customer 3 Record Doesn't Meet Criteria  

我应该只看到:

Customer 2 Record Meets Criteria  
Customer 2 Record Meets Criteria

我尝试使用此自定义SQL命令,但它只提取了一条记录:

SELECT top(2) DateAdded
FROM customer_history.date_of_service
ORDER BY DateAdded DESC

0 个答案:

没有答案