Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hello
Can you help me to remove some rows in my load script with the following rule:
after different step i have a table like that:
Corisq | codntt | nom | nom2 |
A | 1 | AAA | AAAA |
B | 2 | BBB | BBB |
Z | 1 | AAA | |
A | 1 | AAA | |
Z | 3 | CCC | |
C | 4 | DDD | |
Z | 4 | D |
I would like a script to remove the row
3rd row: Z 1 - AAA => because codntt = 1 exist with a codrisq other than Z
and
Z 4 - D => because codntt = 4 exist with a corisq other than Z
So at the end , i like to have a reduce table like that:
Corisq | codntt | nom | nom2 |
A | 1 | AAA | AAAA |
B | 2 | BBB | BBB |
A | 1 | AAA | |
Z | 3 | CCC | |
C | 4 | DDD |
Notice:
As you can see , i keep Z 3 - CCC, because does not exist with another corisq other than Z
As you can see , Z 1 - AAA need to be remove, but the 2 rows with corisq = A and codntt = 1 should be kept.
thk you for your help.
Regards
I believe this would help:
table:
LOAD Corisq,
cordntt,
nom,
nom2
Resident [source table]
Where Corisq<>'Z';
Concatenate(table)
LOAD Corisq,
cordntt,
nom,
nom2
Resident [source table]
Where Corisq='Z' AND not Exists(cordntt);
Hi zarmoton,
You can try the following code:
LOAD Corisq,
codntt,
nom,
nom2
FROM [Data.xlsx] (ooxml, embedded labels, table is Plan1)
Where not (codntt = 1 and Corisq = 'Z')
and not (codntt = 4 and Corisq = 'Z')
;
Hope this helps you.
Regards
I think you want a more general script.
Find attached !
excellent !
Thk you for your answer.
Very nice.