Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to identify and flag Employees with a Code Value of 'P' but I want to flag all rows for that Employee not just the rows with the 'P' value. Here is an example. How can I do this?
Employee ID | Code | Has Value P |
12345 | A | Y |
12345 | B | Y |
12345 | P | Y |
98765 | A | N |
98765 | B | N |
98765 | C | N |
Data:
load * inline [
Employee ID,Code
12345, A
12345, B
12345, P
98765, A
98765, B
98765, C
];
map_P:
mapping load
"Employee ID",
Code
Resident Data
where Code='P';
Final:
Load
"Employee ID",
Code,
If(applymap('map_P', "Employee ID")='P','Y','N') as "Has Value P"
Resident Data;
drop table Data;
Data:
load * inline [
Employee ID,Code
12345, A
12345, B
12345, P
98765, A
98765, B
98765, C
];
map_P:
mapping load
"Employee ID",
Code
Resident Data
where Code='P';
Final:
Load
"Employee ID",
Code,
If(applymap('map_P', "Employee ID")='P','Y','N') as "Has Value P"
Resident Data;
drop table Data;