Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a data having given data
Data Key
A 1
A 2
A 3
B 1
B 2
B 4
C 1
C 2
C 5
and I want to have a table showing those data rows that have common keys like
Data Key
A 1
A 2
B 1
B 2
C 1
C 2
so what should be the approach for it?
Have you tried it yourself?
Is this interview question or exam question???
am not sure about logic but try this
Test:
LOAD * INLINE [
Data, Key
A, 1
A, 2
A, 3
B, 1
B, 2
B, 4
C, 1
C, 2
C, 5
]
Where Key<=2;
Try below
Test:
Load * Inline [
Data,Key
A,1
A,2
A,3
B,1
B,2
B,4
C,1
C,2
C,5
];
Left Join
Load count(Data) as cnt,Key Resident Test
group by Key
;
Temp:
Load max(cnt) as maxcnt Resident Test;
let vMaxCnt = Peek('maxcnt',-1,'Temp');
Final:
Load Data,Key Resident Test
where cnt=$(vMaxCnt);
Drop table Test,Temp;
Regards,
Not sure if this is smth u r looking for...
Test:
Load * Inline [
Data,Key
A,1
A,2
A,3
B,1
B,2
B,4
C,1
C,2
C,5
];
temp:
Load Only(Data) as uData, Key
Resident Test
group by Key
;
temp1:
Load isnull(uData) as nData, Key as Key2
Resident temp
where Len(uData)<=0
;