My SQL Query is,
SELECT EAL_TYPE,
EAL_ID,
ROW_NUMBER ()OVER(PARTITION BY EAL_TYPE,EAL_ID ORDER BY EAL_TYPE,EAL_ID,EAL_ACTION_TIME Desc)SL#,
EAL_STATUS,
EAL_ACTION_TYPE,
EAL_CMPCODE,
ESSET_Description,
EAL_SHOW_IN_ALERT,
ESSETRS_WEIGHTAGE,
Usr_UserRole,ESSET_HeaderTable_Prefix,ESSET_HeaderTable
FROM ESS_ACTION_LOG
LEFT JOIN ESS_ENTRYTYPE_MASTER ON
ESSET_ID=EAL_TYPE
LEFT JOIN User_Profile ON
Usr_LoginID='MK'
LEFT JOIN ESS_ENTRYTYPE_ROLE_SETTINGS ON
ESSETRS_CMPCODE = EAL_CMPCODE AND
ESSETRS_ID = EAL_TYPE AND
ESSETRS_ROLE_ID = Usr_UserRole
INNER JOIN ESSET_HeaderTable ON
ESSET_HeaderTable_Prefix+'_CMPCode'=EAL_CMPCODE AND
ESSET_HeaderTable_Prefix+'_Type'=EAL_TYPE AND
ESSET_HeaderTable_Prefix+'_ID'=EAL_ID
WHERE ESSETRS_WEIGHTAGE IS NOT NULL
In the above query, while executing it shows an error like 'ESSET_HeaderTable object name not found'. But that table name needs to come dynamically from another table. What's wrong with my query. Can anyone help me with this?