raziel3
Registered User.
- Local time
- Yesterday, 20:43
- Joined
- Oct 5, 2017
- Messages
- 311
Sometimes I find myself making one or two additional queries before I can get the join I need.
I have this sql called PROSOURCE that generates the WEIGHTID for me
I have a WEIGHTS table with the fields WEIGHTID (can either be [DIMENEXT] or [CCID]), WEIGHT.
My question is, can I rewrite the current sql to JOIN WEIGHTID to the WEIGHTS table or do I have to make a whole new query using PROSOURCE and the WEIGHTS table?
eg LEFT JOIN IIf([COSTCENTRE].[CCID]=11,[PROBRC].[DIMENEXT],[COSTCENTRE].[CCID]) AS WEIGHTID ON WEIGHTS.WEIGHTID is this even possible?
I have this sql called PROSOURCE that generates the WEIGHTID for me
Code:
SELECT COSTCENTRE.CCID, PROBRC.PDATE, PROBRC.QTYP, PROBRC.DIMENEXT, IIf([COSTCENTRE].[CCID]=11,[PROBRC].[DIMENEXT],[COSTCENTRE].[CCID]) AS WEIGHTID
FROM PROBRC
LEFT JOIN (FGMAS LEFT JOIN COSTCENTRE ON FGMAS.[CCID] = COSTCENTRE.[CCID]) ON PROBRC.FGMID = FGMAS.FGMID;
I have a WEIGHTS table with the fields WEIGHTID (can either be [DIMENEXT] or [CCID]), WEIGHT.
My question is, can I rewrite the current sql to JOIN WEIGHTID to the WEIGHTS table or do I have to make a whole new query using PROSOURCE and the WEIGHTS table?
eg LEFT JOIN IIf([COSTCENTRE].[CCID]=11,[PROBRC].[DIMENEXT],[COSTCENTRE].[CCID]) AS WEIGHTID ON WEIGHTS.WEIGHTID is this even possible?