I am having a question for mounting 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
Return me ...
AsIjustneedtheCODIGO_ESTAGIO,I'minit...
SELECTM5.CODIGO_ESTAGIOFROMMQOP_050M5WHEREM5.NIVEL_ESTRUTURA=2ANDM5.GRUPO_ESTRUTURA='00504'ANDM5.NUMERO_ROTEIRO=1ORDERBYM5.SEQ_OPERACAO
Returns...
Direct DISTINCT would not solve me because I need to keep the stages in order according to SEQ_OPERACAO, even repeating the codes if they are not in sequence. As an example, what I need is ...
|CODIGO_ESTAGIO
|21
|24
|23
|24
|25
Would anyone help me in this case?