create sql view windowsview as; SELECT windows.iID, cWindowLetter,; nQuantity, nWidth, nHeight,; nCostPerSqFt, nPrice, lNameplate,; lProtectiveCovering, lLightbox, lFrames,; lFinalMeasurement, ; lCircular,; CodesStyle.cValue as cWindowStyle, ; CodesTop.cValue as cWindowTop ; FROM windows ; INNER JOIN codes as CodesStyle; ON windows.iStyle = CodesStyle.iID; INNER JOIN codes as CodesTop; ON windows.iTopShape = CodesTop.iID ; WHERE windows.iProject = ?Projects.iID ; order by cWindowLetterThis readonly view joins the windows table to an overloaded lookup table
codes
twice, giving each instance it's own alias and using the alias to get the looked up field out of the table.