Add subquery to lookup BAQ Report Parameter Option1

I am struggling trying to reference the BAQReportParamter table for a BAQ Report.

I would like to either join the parameter table to the BAQReportResults table OR add a subquery to the SSRS “SELECT” to “lookup” the BAQReportParameter.Option1.

In SSMS - here is the Query:
,(Select Avg(Option1) FROM dbo.[BAQReportParameter_73b17a2274b64d22bb14ba90e793638f] ) AS Option1
FROM dbo.[BAQReportResult_73b17a2274b64d22bb14ba90e793638f]

And here is the error message:
Msg 207, Level 16, State 1, Line 5
Invalid column name ‘Option1’.

I must be missing something simple here - any help greatly appreciated.

Ok - I found my typo - it’s not Option1 it’s Option01. The subquery works now.

I was struggling the Join of BAQReportParamter - it turns out the Company field uses a hyphen and the SSRS Select statement did not like that. It broke up the field Cur-Comp into ‘Cur’ and ‘Comp’.

I changed to use the RptLanguageID for both tables and the join works now.


I also ran into a situation recently where my subquery name contained a minus sign “-”. Epicor/SQL did not like that.