Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
What is the use of using where 1=1 and why we are using
Hi,
You can use it in the script to prevent the table to be loaded optimized.
You can load a table optimized super fast or normal (when you use calculations in the script of the table)
Please see the below link
should be equal to
Where 1
regards
Marco
can u explain more detailed
Hi Manoranjan,
It was the case in older versions of QlikView that mapping tables could not be created from Optimised QVD loads. If you executed this script, it the mapping table would simply not exist and the lookup would fail silently:
Map_Table:
LOAD
ID,
Desc
FROM MyQVD.qvd (qvd);
The only way to resolve this was to make the load non-optimised, and the simplest way to do this was to add WHERE 1=1 on the end of it.
This is the only functional reason I can think of for having that code in place. If you are running in a version of QlikView newer than QV9 (I think) then the code is most likely redundant.
The only other reasons I can think of is someone left it there as a place holder, so when they removed an actual WHERE clause they replaced it with something that would always evaluate to true. Or... someone has a set of variable AND statements. By putting WHERE 1=1, they could have a set of variables which may or may not contain an and statement such as AND Customer = 'ABC'. This way, code with several variables that may (or may not) contain ANDs could work, ie:
LOAD
*
FROM MyQVD.qvd (qvd)
WHERE 1=1
$(vPossibleAND1)
$(vPossibleAND2)
$(vPossibleAND3)
I hope that makes some kind of sense?
Cheers,
Steve
Hi Manoranjan,
If you use where 1=1 in normal SQL it will give all the data from the SQL.
I didn't see this in Qlikview script. Hope other folks will give answer. Thank you.