I have a value in a table that's a foregin key. This returns a number which is a code => InvoiceDevice.DeviceType
. That code is decoded in the Code
table, at Code.CodeValue
, then I can use WHERE InvoiceDevice.DeviceType = Code.CodeValue
.
So for example:
- InvoiceDevice.DeviceType = 2
- Code.CodeValue at 2 = iPhone
This is no problem for one column. But how do I display the last value (iPhone) in a VIEW with 68 other columns? They need to be all translated from that code table! How would I do this for all of them?
2条答案
按热度按时间20jt8wwn1#
I think you can try to use Pivot/Unpivot to make that. I have try with 3 Fields, like this :
But no idea about performance...
unftdfkk2#
Might be that this is a simple question of
JOIN
?Not knowing your tables structure my magic crystal ball tells me you might be looking for something like this:
The actual table and column names will need adaptions...
If the code entries within your tables are not unique for a given value, there might be additional columns you need to use as filters.
UPDATE
Reading your question once again it sounds like there are just two tables involved. In this case something like this should help: