MySQL Forums
Forum List  »  Newbie

Re: Need help with join/lookup
Posted by: Peter Brawley
Date: September 28, 2015 11:00AM

Instead of a Create Table cmd with one column then dozens of Alter Table cmds, why not just issue one Create Table cmd!?

> IsInSFDC TEXT(1) NULL
> IsActiveInSFDC TEXT(1) NULL
> MakeInactive TEXT(1) NULL
> InsertInSFDC TEXT(1) NULL ;
> UpdateInSFDC TEXT(1) NULL

Use TinyInt or Bool, or Char(1) if you prefer Y/N. Text is for, um, text.

> UPDATE eidtable_diff SET IsInSFDC = 1 WHERE (ID > 1 AND
> EXISTS(SELECT * FROM sfdc_users WHERE `eidtable_diff`.`Unique_ID`=`sfdc_users`.`FederationIdentifier`));

It's almost always a mistake to store calculated results like that, because it's redundant, and it introduces the possibility of skew. Better to define a View, or since 5.7.6 a Generated column, or just a query eg given eidtable_diff=somevalue ...

select !isnull(select federationidentifier from sfdc_users where federationidentifier=somevalue);

Options: ReplyQuote


Subject
Written By
Posted
September 27, 2015 08:46AM
September 27, 2015 11:25AM
September 28, 2015 01:00AM
Re: Need help with join/lookup
September 28, 2015 11:00AM
September 28, 2015 11:41AM
September 28, 2015 04:20PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.