0
I have a question to mount a query on Oracle, I have the following so far...
SELECT M5.NIVEL_ESTRUTURA
, M5.GRUPO_ESTRUTURA
, M5.SUBGRU_ESTRUTURA
, M5.ITEM_ESTRUTURA
, M5.SEQ_OPERACAO
, M5.CODIGO_ESTAGIO
FROM MQOP_050 M5
WHERE M5.NIVEL_ESTRUTURA = 2
AND M5.GRUPO_ESTRUTURA = '00504'
AND M5.NUMERO_ROTEIRO = 1
ORDER BY M5.SEQ_OPERACAO
Call me back...
Since I only need CODIGO_ESTAGIO, I’m in it...
SELECT M5.CODIGO_ESTAGIO
FROM MQOP_050 M5
WHERE M5.NIVEL_ESTRUTURA = 2
AND M5.GRUPO_ESTRUTURA = '00504'
AND M5.NUMERO_ROTEIRO = 1
ORDER BY M5.SEQ_OPERACAO
Returns...
DISTINCT direct would not solve me, because I need to keep the stages in order according to SEQ_OPERACAO, including repeating the codes if they are not in sequence. As in the example, what I need is...
|CODIGO_ESTAGIO
|21
|24
|23
|24
|25
Someone would know to assist me in this case?
Can’t do what you want through SELECT.
– Reginaldo Rigo
Yeah, I guess I’ll have to do it at the application level anyway... Thanks @Reginaldorigo
– Rafael Weber