Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to exclude data

Hi,

I have two tables:

MainTable:

MemberId

1

2

3

ExcludeTable:

MemberId

1

How to use script to exclude memberid 1?

I just want to get 2,3

Thanks.

6 Replies
pover
Luminary Alumni
Luminary Alumni

Use the exists() function.

ExcludeTable:

Load MemberId as MemberId_Exclude
From ExcludeTable;

MainTable:

Load MemberId
From MainTable
Where not exists(MemberId, MemberId_Exclude);

Regards.

Not applicable
Author

Hi,

But I use SQL not load, how can I use Exist function?

SQL select MemberId as ExcludeMemberId
FROM Test.dbo.ExcludeMember;

SQL select MemberId
FROM Test.dbo.MemberId
;

Not applicable
Author

you can use this as your basis:

LOAD *,

if(Exists(Field1,Field2),Field2)

Resident TableName;



Anonymous
Not applicable
Author

Nothing prevents you from using preceding load:


ExcludeTable:
SQL select MemberId as ExcludeMemberId
FROM Test.dbo.ExcludeMember;
MainTable:
LOAD MemberId
Where not exists(MemberId, MemberId_Exclude);
SQL select MemberId
FROM Test.dbo.MemberId;


Not applicable
Author

Sorry, what's the meaning of ' MemberId_Exclude'?

Not applicable
Author

thats the alias of the MemberId you loaded from

Test.dbo.ExcludeMember