Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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';
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 sure if it will work, but try this:
from MyTable where NOT FieldName in ('x','y','z');
Hello,
Tahnk you but it doenst seem to work.
Br
cristian
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