Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
mr_novice
Creator II
Creator II

Exclude many values in where statement?

Hello all!

Is there a good way of excluding several values in a 'where' statement?

I would like to do something like this:

Table1:

Load *

from MyTable where NOT FieldName='x','y','z';

That is, I want to exclude the values x,y,z in my load.

Br

cristian

5 Replies
michael_maeuser
Partner Ambassador
Partner Ambassador

Hi, there are two ways i guess: 1. from MyTable where NOT FieldName='x' and FieldName='y' and  FieldName='z';

or 2.  from MyTable where FieldName<>'x' and FieldName<>'y' and FieldName<>'z';

mr_novice
Creator II
Creator II
Author

Ok, so there's no way to avoid repeating the fieldname? I mean I have like ten values to exclude so that would men repeating the field name ten times.

Br

cristian

Not applicable

Not sure if it will work, but try this:

from MyTable where NOT FieldName in ('x','y','z');

mr_novice
Creator II
Creator II
Author

Hello,

Tahnk you but it doenst seem to work.

Br

cristian

erichshiino
Partner - Master
Partner - Master

Hi, you can create a table with the values you want to exclude, then you use a where not exists command:.

For example:

Exclusion:

LOAD * INLINE [

    Exclude

    x

    y

    z

];

Table:

LOAD * INLINE [

    FieldName

    a

    b

    c

    d

    x

    y

    z

    a

]

where not Exists( Exclude, FieldName)

;

Hope this helps,

Erich