Skip to main content
Announcements
Jan 15, Trends 2025! Get expert guidance to thrive post-AI with After AI: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Join 2 tables but excluding elements from table 2 absent from table 1

Hi again,

I'm trying to get data from a mysql table (customer ID / Mail_registration) and to get only results of customer ID that exist in my 1st table (taken from a csv):

I've tried a left join like this:

I have my master table above and then:

ODBC CONNECT TO idb01 (XUserId isxxxxxxxxxxxxx , XPassword is xxxxxxxxxxxxx);

LEFT JOIN (master)

SQL SELECT customerCode,

    mailMagazineCode

FROM fujiyama.MailMagazineSubscriber;

But it seems like it's either duplicating the customerCode or doing something else because my sales appear more than twice as high as the "real" level.

Any idea on how to solve this ?

Thanks in advance !

T

2 Replies
Anonymous
Not applicable
Author

Is customerCode enough to link both the tables? Should you have more specific key e.g. concatenate CompanyCode with customerCode?

Also try grouping your second table.

LEFT JOIN (master)

SQL SELECT customerCode,

    mailMagazineCode

FROM fujiyama.MailMagazineSubscriber

GROUP BY customerCode,    mailMagazineCode;

I hope this helps!

Regards

~MultiView

Not applicable
Author

Let me give this a try. No need to concatenate anything I guess...

Thanks a lot !!!