Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare two not equal values as equal 1

Status
Not open for further replies.

ElEye

IS-IT--Management
Nov 17, 2001
187
US
This may be simple, but so is my brain. So I seek assistance with the following.

I need to compare a field in each of two tables to create an "is equal" where not equal. For example, "USA" in table one would be considered equal to "United States" in table two, "CAN" in table one would be considered equal to "Canada" in table two. And so on, for dozens of values. Where the values are "equal" no action is taken. Where the values are "unequal" I will take an action, such as an update on table one or an update on table two.

So, I created a third table with the "USA" in column one, "United States" in column two for one record, and a record in that third table for all the other "equal" values.

But where do I go from here?

TIA!

Dave [idea]
[]
 
Something like that:
Code:
Select * From TableShort S
Left Join TableTranslate T On S.Short = T.Short
Left Join TableLong      L On T.Long = L.Long

Where you have NULLs in the result, you have missing relations.

Bye, Olaf.

 
You can of course also check from the other side:

Code:
Select * From TableLong L
Left Join TableTranslate T On L.Long = T.Long
Left Join TableShort     S On T.Short = S.Short

And if there is a join condition of TableLong and TableShort you specify that within the second join, additionally to the join condition with T, eg AND S.someID = L.someotherID.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top