Hey guys! I created that sql expression below in Create Database View to simplify the users queries and it worked well, but I've acrossed with some issues.
When I made join i lost the fields subtype_codes. Then, it remains just the associated default value.
Is there a way to conserve subtype_code after doing that join tables?
SELECT adhp.name_txt, adhp.type_code, adhp.military_code, adhpsurfacearea.subtypecode, adhpsurfacearea.globalid, adhpsurfacearea.length_val, surfacecharacteristic.composition_code FROM adhp JOIN adhpsurfacearea ON adhp.gfid = adhpsurfacearea.adhp_id JOIN surfacecharacteristic ON surfacecharacteristic.gfid = adhpsurfacearea.surfacecharacteristic_id;
In this case, the field is subtype_code from adhpsurfacearea.
Thanks in advance.
It seems like you could join to the lookup table and display the values instead of the codes. It would follow this pattern:
SELECT
adhp.name_txt,
adhp.type_code,
adhp.military_code,
--adhpsurfacearea.subtypecode,
LU.subtypevalue,
adhpsurfacearea.globalid,
adhpsurfacearea.length_val,
surfacecharacteristic.composition_code
FROM
adhp
JOIN adhpsurfacearea ON adhp.gfid = adhpsurfacearea.adhp_id
JOIN surfacecharacteristic ON surfacecharacteristic.gfid = adhpsurfacearea.surfacecharacteristic_id
JOIN [SUBTYPECODELOOKUPTABLENAME] LU ON LU.subtypecode = adhpsurfacearea.subtypecode