Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
pakdoust
Partner - Contributor
Partner - Contributor

distinct data

Hi

With the script below I have a result of 4 rows including PID '123' two times (with 'ab' and 'abcdef'). 

Now I'd like to keep only one row if it has the same PID  : in this cas I'd like to keep '123', 'abcdef' instead of '123', 'ab'

 

Table1:
LOAD * Inline [
PID , brand
123 , ab
120, ab
];

NoConcatenate
Table2:
LOAD * Inline [
PID , brand
123 , abcdef
145 , ab
];


Concatenate
Load distinct *
Resident Table1;

 

Result wanted :

120, ab

123, abcdef

145, ab

 

Thanks

Labels (2)
2 Solutions

Accepted Solutions
JGMDataAnalysis
Creator III
Creator III

Try with this...

Table2:
LOAD * INLINE [
  PID, brand
  123, abcdef
  145, ab
];

Table1:
LOAD * INLINE [
  PID, brand
  123, ab
  120, ab
]
WHERE Not Exists(PID);

 

View solution in original post

JGMDataAnalysis
Creator III
Creator III

 

Table1:
LOAD * INLINE [
  PID, brand
  123, ab
  120, ab
];

Table2:
NOCONCATENATE
LOAD *, PID AS tmpPID
INLINE [
  PID, brand
  123, abcdef
  145, ab
]
;
CONCATENATE(Table2)
LOAD * RESIDENT Table1
WHERE Not Exists(tmpPID, PID);

DROP TABLE Table1;
DROP FIELD tmpPID;

 

View solution in original post

3 Replies
JGMDataAnalysis
Creator III
Creator III

Try with this...

Table2:
LOAD * INLINE [
  PID, brand
  123, abcdef
  145, ab
];

Table1:
LOAD * INLINE [
  PID, brand
  123, ab
  120, ab
]
WHERE Not Exists(PID);

 

pakdoust
Partner - Contributor
Partner - Contributor
Author

Is it possible to get the same result without changing the order of table LOADS ?
JGMDataAnalysis
Creator III
Creator III

 

Table1:
LOAD * INLINE [
  PID, brand
  123, ab
  120, ab
];

Table2:
NOCONCATENATE
LOAD *, PID AS tmpPID
INLINE [
  PID, brand
  123, abcdef
  145, ab
]
;
CONCATENATE(Table2)
LOAD * RESIDENT Table1
WHERE Not Exists(tmpPID, PID);

DROP TABLE Table1;
DROP FIELD tmpPID;