Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have a table like this:
Field1, Field2
1, A
2,
3,
4, B
5,
So field2 is empty in rows 2,3 and 5.
I wish to get a field3 where if row in field2 is empty it takes the value before in field3, and if not it takes the value in field2, resulting this:
Field1, Field2, Field3
1, A A
2, A
3, A
4, B B
5, B
How can do it as easy as possible?
Thnaks
Maybe like
LOAD Field1,
If( Len(Trim(Field2)), Field2, Peek(Field3) ) as Field3
FROM YourTable;
Maybe like
LOAD Field1,
If( Len(Trim(Field2)), Field2, Peek(Field3) ) as Field3
FROM YourTable;
hi,
Try this:
Table:
LOAD Field1,
Field2,
If(Len(Trim(Field2)) > 0, Field2, Peek('Field3')) as Field3;
LOAD * Inline [
Field1, Field2
1, A
2,
3,
4, B
5,
];