Skip to content

Instantly share code, notes, and snippets.

@pedroelsner
Created September 9, 2014 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedroelsner/90af693bd42c98001428 to your computer and use it in GitHub Desktop.
Save pedroelsner/90af693bd42c98001428 to your computer and use it in GitHub Desktop.
Script Qlikview para Alexandre Gabriel
Original:
LOAD * INLINE [
Objeto, ID
Ref1, 13
Ref1, 16
Ref1, 19
Ref1, 32
];
Temp:
LOAD Distinct
Objeto & '.' & ID AS LinhaID
, Objeto
, ID
Resident Original;
Left Join (Temp)
LOAD Distinct
Objeto
, ID AS OUTROS_IDs
Resident Original;
Left Join (Temp)
LOAD Distinct
LinhaID
, if(OUTROS_IDs < ID, OUTROS_IDs, Null()) AS MAX_MIN_ID
Resident Temp;
DROP Table Original;
Final:
LOAD Distinct
Objeto & '.' & ID AS LinhaID
, Objeto
, ID
Resident Temp;
Left Join (Final)
LOAD LinhaID
, Max(MAX_MIN_ID) AS MAX_ID
, Min(MAX_MIN_ID) AS MIN_ID
Resident Temp
Group by LinhaID;
DROP Table Temp;
DROP Field LinhaID FROM Final;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment