我有一个连接 5 个表的 SQL 语句,但我认为我必须错误地连接它们。我有一个 asp.net 表单,它允许通过复选框和下拉列表进行输入,因此我正在基于 UI 构建 SQL 内部代码。
搜索条件将包括来自 3 个不同表的字段。我得到的错误是
无法绑定多部分标识符“openingReq.bgChk”。
我觉得我的加入一定是问题所在,但我不确定我应该如何更改它们以使其工作。
这是SQL语句
SELECT COMPANY.NAME,
SITE.NAME,
OPENING.JOBTITLE,
( OPENINGSCHED.WEEKLYHOURSLOW + '-'
+ OPENINGSCHED.WEEKLYHOURSHIGH ) AS weeklyHours,
( OPENINGCOMP.WAGELOW & '-' & OPENINGCOMP.WAGEHIGH ) AS payRange
FROM COMPANY
INNER JOIN [SITE]
ON COMPANY.ORGID = SITE.ORGID
INNER JOIN OPENING
ON SITE.SITEID = OPENING.SITEID
INNER JOIN OPENINGSCHED
ON OPENING.OPENINGID = OPENINGSCHED.OPENINGID
INNER JOIN OPENINGCOMP
ON OPENINGSCHED.OPENINGID = OPENINGCOMP.OPENINGID
WHERE OPENING.JOBORWE = 'Job'
AND OPENING.OCCUPATIONCODE = 59
AND COMPANY.SECTORCODE = 202
AND OPENING.ONBUSROUTE = 1
AND ( OPENING.LANGCODE = 1
OR OPENING.LANGCODE = 7
OR OPENING.LANGCODE = 22 )
AND OPENING.TIER = 1
AND OPENINGREQ.BGCHK = 1
AND OPENINGREQ.MINEXP = 'no minimum experience'
AND OPENINGREQ.MINED = 'no minimum education'