csv-parser / program-examples / pr3.cql
pr3.cql
Raw
p = import("P.csv");
q = import("Q.csv");

for pr in p {
    for qr in q {
        if pr[0] == qr[0] {
            col1 = if empty(pr[1]) {qr[1]} else {pr[1]};
            col2 = if empty(pr[2]) {qr[2]} else {pr[2]};
            col3 = if empty(pr[3]) {qr[3]} else {pr[3]};
            out.add(pr[0], col1, col2, col3);
        }
    }
};