Question : Custom SQL in Web Intelligence Error

I'm using custom sql in a webi query, and I'm just trying to add an object to the sql called BDEBI.LOAN_STATUS.MSP_LAST_RUN_DATE.  I know Webi wants to have the same number result objects as in the custom sql, so I also added it to the result objects. However I'm getting an error:

A database error occured. The database error text is: [IBM][CLI Driver][DB2/LINUXX8664] SQL0206N  "BDEBI.LOAN_STATUS.MSP_LAST_RUN_DATE" is not valid in the context where it is used.  SQLSTATE=42703
. (WIS 10901)


Here is the Custom Sql I'm using to get the error.  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
Select 
  L.LOAN_NUMBER,
FCS.STEP_CODE,
  LS.FOR_STATUS,
  UDF.USER_03_POSITION_FIELD_4B as HMP_FLAG,
  FCS.ACTUAL_COMPLETION_DATE,
  LETTER.LETTER_DATE,
BDEBI.LOAN_STATUS.MSP_LAST_RUN_DATE

FROM
BDE.LOAN_V L
INNER JOIN BDE.USER_DEFINED_V UDF ON (L.LOAN_NUMBER=UDF.LOAN_NUMBER)
INNER JOIN BDEBI.LOAN_STATUS LS ON (L.LOAN_NUMBER=LS.LOAN_NUMBER)
INNER JOIN BDE.FORECLOSURE_STEP_V FCS ON (L.LOAN_NUMBER = FCS.LOAN_NUMBER)
LEFT OUTER JOIN (SELECT LW.LOAN_NUMBER, LW.LETTER_DATE FROM BDE.ONLINE_LETTER_WRITER_V LW
				WHERE LW.LETTER_ID  IN  ('LM500', 'LM507')) LETTER ON (L.LOAN_NUMBER = LETTER.LOAN_NUMBER)
WHERE
  ( 
LS.FOR_STATUS  IS NOT NULL  
AND  UDF.USER_03_POSITION_FIELD_4B  =  'YY'
and FCS.STEP_CODE  =  '072' AND FCS.ACTUAL_COMPLETION_DATE IS NOT NULL
And  FCS.ACTUAL_COMPLETION_DATE  BETWEEN  @variable('Select Start Date') AND @variable('Select End Date')
AND L.LOAN_NUMBER NOT IN (SELECT LOAN_NUMBER FROM BDE.FORECLOSURE_STEP_V
							WHERE (STEP_CODE  =  '075' AND ACTUAL_COMPLETION_DATE IS NOT NULL)

)
  )
GROUP BY
  L.LOAN_NUMBER,
FCS.STEP_CODE,
  LS.FOR_STATUS,
  UDF.USER_03_POSITION_FIELD_4B,
  FCS.ACTUAL_COMPLETION_DATE,
  LETTER.LETTER_DATE
FOR FETCH ONLY WITH UR



Answer : Custom SQL in Web Intelligence Error

I got it!  Needed to change the name to LS.MSP_LAST_RUN_DATE

Not the Alias for that table below (LS) – so I was calling a table that doesn’t exist
Random Solutions  
 
programming4us programming4us