Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Demlet
Contributor III
Contributor III

Exclude values from table?

I have been trying multiple ways to exclude demo users from all users -  joining, using where UserID<>USER_ID, etc. I also tried this method below from another post, with no luck. I put the select statements before the loads and it ran, but then the PEOPLE_ID wouldn't return for All_Users.... this is so simple in normal SQL.


How do I fix this? Thanks.


Demo_Users:

LOAD

USER_ID AS D.USER_ID;

SELECT

"USER_ID"

FROM "DEMO_USERS";

All_Users:

LOAD

PEOPLE_ID,

USER_ID AS A.USER_ID

WHERE NOT EXISTS(D.USER_ID,A.USER_ID);

SELECT

"USER_ID",

"PEOPLE_ID"

FROM "All_Users";


DROP TABLE Demo_Users;

6 Replies
Gysbert_Wassenaar

Change WHERE NOT EXISTS(D.USER_ID,A.USER_ID); to WHERE NOT EXISTS(D.USER_ID,USER_ID);



talk is cheap, supply exceeds demand
YoussefBelloum
Champion
Champion

Hi,

this line is wrong:

WHERE NOT EXISTS(D.USER_ID,A.USER_ID);


replace it to this:


WHERE NOT EXISTS(D.USER_ID,USER_ID);

Demlet
Contributor III
Contributor III
Author

Thanks for the quick replies Youssef, and Gysbert! This worked.

I would like to apologize for the duplicate posts (not intentional), which I deleted. There seems to be some lag in the site. I posted the discussion but it never showed as posted. I went to re-post and it had a "recover" option, so I recovered and posted it. Also when I click on the discussion, none of your replies are visible. I can only see the replies in the feed...

Thanks again!

Demlet
Contributor III
Contributor III
Author

Hi Gysbert,

This ran with no errors, but the All_Users table is showing zero values for both PEOPLE_ID & A.USER_ID.

I can confirm that there are only 13 D.USER_ID's, and there are thousands of A.USER_ID's.

Any idea what may be happening here? Thanks in advance.

Gysbert_Wassenaar

Is there another table already loaded that also has a field D.USER_ID?


talk is cheap, supply exceeds demand
Demlet
Contributor III
Contributor III
Author

There are no other tables with D.USER_ID. Thanks