1+ SELECT
2+ SKIP @firstRowIndex@
3+ FIRST @pageSize@
4+ r.round_id as id,
5+ r.name as name,
6+ r.short_name as short_name,
7+ rt.round_type_desc,
8+ CASE WHEN (UPPER(r.status) = 'A') THEN
9+ 'Active'
10+ WHEN (UPPER(r.status) = 'P') THEN
11+ 'Past'
12+ WHEN (UPPER(r.status) = 'F') THEN
13+ 'Draft'
14+ ELSE NULL
15+ END AS round_status,
16+ r.registration_limit,
17+ CASE WHEN (r.invitational = 0) THEN
18+ 'Not'
19+ WHEN (r.invitational = 1) THEN
20+ 'Normal'
21+ WHEN (r.invitational = 2) THEN
22+ 'Negate'
23+ ELSE NULL
24+ END AS invitational,
25+ reg.region_name,
26+ rs1.start_time as start_time_1,
27+ rs1.end_time as end_time_1,
28+ CASE WHEN (UPPER(rs1.status) = 'A') THEN
29+ 'Active'
30+ WHEN (UPPER(rs1.status) = 'P') THEN
31+ 'Past'
32+ WHEN (UPPER(rs1.status) = 'F') THEN
33+ 'Draft'
34+ ELSE NULL
35+ END as status_1,
36+ ((select segment_desc from segment where segment_id = 1) || ' Phase') as name_1,
37+ rs2.start_time as start_time_2,
38+ rs2.end_time as end_time_2,
39+ CASE WHEN (UPPER(rs2.status) = 'A') THEN
40+ 'Active'
41+ WHEN (UPPER(rs2.status) = 'P') THEN
42+ 'Past'
43+ WHEN (UPPER(rs2.status) = 'F') THEN
44+ 'Draft'
45+ ELSE NULL
46+ END as status_2,
47+ (select segment_desc from segment where segment_id = 2) as name_2,
48+ rs3.start_time as start_time_3,
49+ rs3.end_time as end_time_3,
50+ CASE WHEN (UPPER(rs3.status) = 'A') THEN
51+ 'Active'
52+ WHEN (UPPER(rs3.status) = 'P') THEN
53+ 'Past'
54+ WHEN (UPPER(rs3.status) = 'F') THEN
55+ 'Draft'
56+ ELSE NULL
57+ END as status_3,
58+ (select segment_desc from segment where segment_id = 3) as name_3,
59+ rs4.start_time as start_time_4,
60+ rs4.end_time as end_time_4,
61+ CASE WHEN (UPPER(rs4.status) = 'A') THEN
62+ 'Active'
63+ WHEN (UPPER(rs4.status) = 'P') THEN
64+ 'Past'
65+ WHEN (UPPER(rs4.status) = 'F') THEN
66+ 'Draft'
67+ ELSE NULL
68+ END as status_4,
69+ (select segment_desc from segment where segment_id = 4) as name_4,
70+ rs5.start_time as start_time_5,
71+ rs5.end_time as end_time_5,
72+ CASE WHEN (UPPER(rs5.status) = 'A') THEN
73+ 'Active'
74+ WHEN (UPPER(rs5.status) = 'P') THEN
75+ 'Past'
76+ WHEN (UPPER(rs5.status) = 'F') THEN
77+ 'Draft'
78+ ELSE NULL
79+ END as status_5,
80+ (select segment_desc from segment where segment_id = 5) as name_5,
81+ rs6.start_time as start_time_6,
82+ rs6.end_time as end_time_6,
83+ CASE WHEN (UPPER(rs6.status) = 'A') THEN
84+ 'Active'
85+ WHEN (UPPER(rs6.status) = 'P') THEN
86+ 'Past'
87+ WHEN (UPPER(rs6.status) = 'F') THEN
88+ 'Draft'
89+ ELSE NULL
90+ END as status_6,
91+ (select segment_desc from segment where segment_id = 6) as name_6,
92+ rs7.start_time as start_time_7,
93+ rs7.end_time as end_time_7,
94+ CASE WHEN (UPPER(rs7.status) = 'A') THEN
95+ 'Active'
96+ WHEN (UPPER(rs7.status) = 'P') THEN
97+ 'Past'
98+ WHEN (UPPER(rs7.status) = 'F') THEN
99+ 'Draft'
100+ ELSE NULL
101+ END as status_7,
102+ (select segment_desc from segment where segment_id = 7) as name_7
103+ FROM (round r
104+ LEFT OUTER JOIN round_type_lu rt
105+ ON r.round_type_id=rt.round_type_id
106+ LEFT OUTER JOIN region reg
107+ ON r.region_id=reg.region_id
108+ LEFT OUTER JOIN round_segment rs1
109+ ON r.round_id=rs1.round_id and rs1.segment_id = 1
110+ LEFT OUTER JOIN round_segment rs2
111+ ON r.round_id=rs2.round_id and rs2.segment_id = 2
112+ LEFT OUTER JOIN round_segment rs3
113+ ON r.round_id=rs3.round_id and rs3.segment_id = 3
114+ LEFT OUTER JOIN round_segment rs4
115+ ON r.round_id=rs4.round_id and rs4.segment_id = 4
116+ LEFT OUTER JOIN round_segment rs5
117+ ON r.round_id=rs5.round_id and rs5.segment_id = 5
118+ LEFT OUTER JOIN round_segment rs6
119+ ON r.round_id=rs6.round_id and rs6.segment_id = 6
120+ LEFT OUTER JOIN round_segment rs7
121+ ON r.round_id=rs7.round_id and rs7.segment_id = 7
122+ )
123+ WHERE @filterCondition@
124+ ORDER BY @sortColumn@ @sortOrder@
0 commit comments