这是我在这里的第一篇文章。我正在处理支票,我在 Oracle 11g 数据库中有这个
WITH cheques AS (
SELECT 1 ch_no,'U' ch_status FROM dual UNION ALL
SELECT 2 ch_no,'U' ch_status FROM dual UNION ALL
SELECT 3 ch_no,'T' ch_status FROM dual UNION ALL
SELECT 4 ch_no,'T' ch_status FROM dual UNION ALL
SELECT 5 ch_no,'U' ch_status FROM dual UNION ALL
SELECT 6 ch_no,'U' ch_status FROM dual UNION ALL
SELECT 7 ch_no,'C' ch_status FROM dual UNION ALL
SELECT 8 ch_no,'U' ch_status FROM dual UNION ALL
SELECT 9 ch_no,'U' ch_status FROM dual UNION ALL
SELECT 10 ch_no,'C' ch_status FROM dual UNION ALL
SELECT 11 ch_no,'U' ch_status FROM dual UNION ALL
SELECT 12 ch_no,'U' ch_status FROM dual UNION ALL
SELECT 13 ch_no,'X' ch_status FROM dual UNION ALL
SELECT 14 ch_no,'X' ch_status FROM dual UNION ALL
SELECT 15 ch_no,'T' ch_status FROM dual UNION ALL
SELECT 16 ch_no,'U' ch_status FROM dual UNION ALL
SELECT 17 ch_no,'U' ch_status FROM dual UNION ALL
SELECT 18 ch_no,'I' ch_status FROM dual UNION ALL
SELECT 19 ch_no,'I' ch_status FROM dual UNION ALL
SELECT 20 ch_no,'U' ch_status FROM dual
)
我希望以这种方式获得它们:
Status Min Max
U 1 2
U 5 6
U 8 9
U 11 12
U 16 17
U 20 20
C 7 7
C 10 10
T 3 4
T 15 15
X 13 14
I 18 19
因此,在 Reporting Services 2008 中,我将能够像这样显示它们:
U C T X I
Min Max Min Max Min Max Min Max Min Max
1 2 7 7 3 4 13 14 18 19
5 6 10 10 15 15
8 9
11 12
16 17
20 20
这里的问题是如何获得这个,如何根据他们的状态获得每张支票的最小值和最大值?我已经搜索过,但我找不到任何东西。
对不起我的英语不好。
谢谢!