Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
manoranjan_d
Specialist
Specialist

Where 1=1

Hi all,

What is the use of using where 1=1 and why we are using

6 Replies
jjordaan
Partner - Specialist
Partner - Specialist

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)

Kushal_Chawda

Please see the below link

https://community.qlik.com/thread/41113

MarcoWedel

should be equal to

Where 1

regards

Marco

manoranjan_d
Specialist
Specialist
Author

can u explain more detailed

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

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

qlikviewwizard
Master II
Master II

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.