我之前得到了一些非常好的帮助,我很感激。我还有另一个唱片选择混乱。
我有一个参数需要设置为结束日期。
我需要从名为 state_change 的表中提取结束日期之前的最新状态。
我需要从报告中排除在该时间段内未处于所需状态的任何记录。
state 当前设置为 state_change.new_state
( {@grouping} = "Orders" and rec_date < {?endDate} and {@state} in [0,2,5] )
OR
( {@grouping} = "Stock" and rec_date < {?endDate} and {@state} in [1,2,3,5,7] )
如果我可以运行 SQL 查询来提取这些信息,它可能会起作用,但我不知道该怎么做。
本质上,我需要 @state 是:
Select max(new_state)
From state_change
where change_time < {?endDate}
但在每个项目级别。
任何帮助,将不胜感激。