Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello! Hope for your help again!
I have the situation with SQL table. Following columns:
From To OtherColumns
05T 909352 sdfdsfsfs
03T 346347347 sdfsdfsdf
8925235 05T sdfdfs
03T sdf8325 466346dfgsg
23525ff 07T jlkjfaf lsaf
I need from two Columns From and To, get only one Column Location, where will be one value from FROM or TO. I am looking for these short values 05T, 03T, 06T etc. These are known for me.
The result must be:
Location OtherColumns
05T sdfdsfsfs
03T sdfsdfsdf
05T sdfdfs
03T 466346dfgsg
07T jlkjfaf lsaf
Thank for your help in advance!
Try the code in qlikview load section rather than in sql, like:
Load
*,
If(Right(From,1)='T', From,
If(Right(Tp,1)='T', To)) As Location
;
SQL Select
<your fields>..
From <>;
If you can decide on a pattern, like 'the last character' of from/to column always have 'T', try like:
If(Right(From,1)='T', From,
If(Right(Tp,1)='T', To)) As Location
IF(Right(Tbl_DocumentHeaders."New FA Location Code",1)='T', Tbl_DocumentHeaders."New FA Location Code",
IF(Right(Tbl_DocumentHeaders."FA Location Code",1)='T', Tbl_DocumentHeaders."FA Location Code")) AS Location,
I am getting syntax error (added to working QSL script), and can't find the reason:
You could do something like:
Select "From" as Location,OtherColumns
from table
where From like '%T%'
Union Select "To" as Location, OtherColumns
from table
where "To" like '%T%'
Try the code in qlikview load section rather than in sql, like:
Load
*,
If(Right(From,1)='T', From,
If(Right(Tp,1)='T', To)) As Location
;
SQL Select
<your fields>..
From <>;
Thank you!
My first Load ... finally understood how it works!