As a trivial example, suppose I have two tables:
Table "INDEX" where FLDA is the index and FLDB is an arbitrary matching value
Code:
FLDA FLDB
1 AAAA 1111
2 BBBB 2222
3 CCCC 3333
4 DDDD 4444
Table "MASTER" where there are over 30 SYN# fields
Code:
SYN1 SYN2 SYN3 SYN4
1 AAAA BBBB CCCC DDDD
2 AAAA AAAA AAAA BBBB
3 AAAA BBBB BBBB BBBB
4 BBBB CCCC CCCC DDDD
Each MASTER.SYN# field will
allways match a record of INDEX.FLDA. I want to return the value of INDEX.FLDB, so my desired query resultset is:
Code:
SYN1 SYN2 SYN3 SYN4
1 1111 2222 3333 4444
2 1111 1111 1111 2222
3 1111 2222 2222 2222
4 2222 3333 3333 4444
So, I can do one field at a time with something like:
SELECT INDEX.FLDB FROM INDEX, MASTER
WHERE MASTER.SYN1=INDEX.FLDA;
... but how do I do SYN2, SYN3, etc all at once?
Short of nesting 30 queries or creating 30 copies of the INDEX table, is there a way to accomplish this with regular SQL?
Failing that, I guess I'll have to figure out how to make a
VB or PL/SQL routine (client is access, served by oracle), but this seemed like a job for SQL...