INNER JOIN based on equivalent values, instead of equal values

philvalko

Registered User.
Local time
Yesterday, 21:58
Joined
Sep 6, 2005
Messages
25
I'd like to create a query which will consist of simple SELECT statements as follows:

PHP:
SELECT [table1].[field1], [table2].[field1], [table2].[field2]
FROM table1 INNER JOIN table2 ON ([table1].[fieldX] = [table2].[fieldX]);

The challenge arises b/c instead of joining on equal values, such as the following:
PHP:
[table1] INNER JOIN [table2] ON [table1].[field1] = [table2].[field1]

I would like to join based on equivalencies, such as:
[table1] INNER JOIN [table2] ON [table1].[field1] = 34 is equivalent to [table2].[field1] = 2;

I do not know the proper syntax, so this is where I need help. I tried to search online without any success.

I appreciate your help in advance.
 
I believe you would have to create a table that would define the equivalencies. Then join the other two tables to it.
 

Users who are viewing this thread

Back
Top Bottom