you do exactly what the lookup thingie is doing, but you do it explicitly, in plain sight, and YOU will know exactly what is going on.
mycodestable:
PKcodes integer
Descr
mymaintable:
blah1,
blah2,
blah3,
FKcodes integer <<< foreign key pointing at PKcodes in mycodestable
blah4,
...
blah17
maybe you are using a smaller numeric type than integer - makes no difference, but use the same datatype for FK and PK. you will want referential integrity enforced (most probably without cascades).
your query then looks like:
Code:
SELECT a.blah1, a.blah2, a.blah3, a.FKcodes, b.Descr
FROM mymaintable a
LEFT JOIN mycodestable b
ON a.FKcodes = b.PKcodes
ORDER BY a.FKcodes;
all the lookup marvel is doing is making that same JOIN for you behind the scenes (...and sowing confusion about the datatype of FKcodes).
do your own JOIN and you will know for 100% certain that your FK is an integer (and not the string that lookup magic wants to show you).
izy