Home > database >  MS is essentially grouped by two columns for the same group of the third column whether there is dif
MS is essentially grouped by two columns for the same group of the third column whether there is dif

Time:01-16

 job id alt_group ref_des 
16731 129 96 C100
16731 96 96 C100
16731 96 96 C101
16731 129 96 C101
16731 186 186 C102
16731 192 186 C102
16731 192 186 C103
16731 186 186 C103
16731 96 96 C104
16731 129 96 C104
16731 174 168 C106
16731 168 168 C106
16731 96 96 C107
16731 129 96 C107
16731 186 186 C109
16731 192 186 C109
16731 192 186 C110
16731 186 186 C110
16731 19 19 C114
16731, 144, 19 C114
16731 174 168 C115
16731 168 168 C115
16731 168 168 C116
16731 174 168 C116
16731 149 151 C12
16731 151 151 C12
16731 156 156 C140
16731 158 156 C140
16731 158 156 C148
16731 156 156 C148
16731 129 96 C150
16731 96 96 C150
16731 156 156 C152
16731 158 156 C152
16731 161 161 C153
16731 118 161 C153
16731 118 161 C156
16731 161 161 C156
16731 130 203 C166
16731 203 203 C166
16731 129 96 C169
16731 96 96 C169
16731 96 96 C171
16731 129 96 C171
16731 129 96 C172
16731 96 96 C172
16731 96 96 C174
16731 129 96 C174
16731 174 168 C177
16731 168 168 C177
16731 123 154 C178
16731 154 154 C178
16731 151 151 C18
16731 149 151 C18
16731 124 102 C182
16731 102 102 C182
16731 142 169 C185
16731 169 169 C185
16731 161 161 C188
16731 118 161 C188
16731 96 96 C189
16731 129 96 C189
16731 149 151 C19
16731 151 151 C19
16731 129 96 C191
16731 96 96 C191
16731 96 96 C192
16731 129 96 C192
16731 158 156 C193
16731 156 156 C193
16731 156 156 C194
16731 158 156 C194
16731 162 205 C202
16731 205 205 C202
16731 151 151 C21
16731 149 151 C21
16731 149 151 C22
16731 151 151 C22
16731 166 166 C31 microcomputer
16731 179 166 C31 microcomputer
16731 120 166 C31 microcomputer
16731 120 166 C32
16731 179 166 C32
16731 166 166 C32
16731 168 168 C35
16731 174 168 C35
16731 147 189 C36
16731 189 189 C36
16731 162 205 C4
16731 205 205 C4
16731 154 154 C46
16731 123 154 C46
16731 130 203 C49
16731 203 203 C49
16731 205 205 C5
16731 162 205 C5
16731 162 205 C50
16731 205 205 C50
16731 168 168 C51
16731 174 168 C51
16731 154 154 C58
16731 123 154 C58
16731 130 203 C59
16731 203 203 C59
16731 151 151 C6
16731 149 151 C6
16731 162 205 C61
16731 205 205 C61
16731 174 168 C63
16731 168 168 C63
16731 162 205 C71
16731 205 205 C71
16731 168 168 C77
16731 174 168 C77
16731 174 168 C92
16731 168 168 C92
16731 186 186 C93
16731 192 186 C93
16731 168 168 C94
16731 174 168 C94
16731 127 98 D10
16731 98 98 D10
16731 98 98 D11
16731 127 98 D11
16731 127 98 D12
16731 98 98 D12
16731 97 97 D7
16731 128 97 D7
16731 128 97 D8
16731 97 97 D8
16731 94 94 D9
16731 131 94 D9
16731 99 99 FB14 - FB22
16731 126 99 FB14 - FB22
16731 126 99 FB1 - FB9
16731 99 99 FB1 - FB9
16731 100 100 L1
16731 125 100 L1
34 L13 34-16731 L16
16731, 139, 34 L13 - L16
16731, 140, 34 L13 - L16
16731 138 35 L19
16731 35 35 L19
16731 125 100 L2
16731 100 100 L2
16731 36 36 L20
16731, 137, 36 L20
16731 141 33 L3
16731 33 33 L3
33 L6 33-16731 L9
16731 141 33 L6 - L9
16731 104 104 Q1
16731 122 104 Q1
16731 122 104 Q10
16731 104 104 Q10
16731 104 104 Q11
16731 122 104 Q11
16731 39 39 Q13
16731, 136, 39 Q13
16731 122 104 Q14 during April 12-15
16731 104 104 Q14 during April 12-15
16731 104 104 Q16
16731 122 104 Q16
16731 122 104 Q17
16731 104 104 Q17
16731 104 104 Q18
16731 122 104 Q18
16731 122 104 Q2
16731 104 104 Q2
16731 89 89 U30
16731 133 89 U30
16731 134 89 U30
16731 132 91 U32
16731 91 91 U32
16731 80 80 U6
16731 135 80 U6
16731 116 116 U7
16731 117 116 U7

Such as the above-mentioned, I think in the job, ref_des groups, then ask the same set of alt_grou whether there is a different value, not a cursor with convergent thinking how to write code?

CodePudding user response:

SELECT
A. OB,
A.R EF_DESC,
CASE the WHEN MAX (A.A LT_GROU)=MIN (A.A LT_GROU) THEN 'does not exist different' ELSE 'different' END
FROM the TABLE of A GROUP BY a. OB, A.R EF_DESC
So I can?
  • Related