这是我的查询
SELECT cont.FILTER_VALUE as filter,
o.[OBJECT_ID] as Id, o.[OBJECT_NAME] as Name, o.DESCRIPTION as Description, o.CREATED as Created,
o.MODIFIED as Modified, u.[LOGIN] as LastModifiedByLogin, o.[OBJECT_NAME] as ObjectName, t.[TEMPLATE_NAME] as TemplateName--,p.[PAGE_NAME] as PageName
FROM
[OBJECT] AS o
LEFT OUTER JOIN [CONTAINER] as cont
on cont.[OBJECT_ID] = o.[OBJECT_ID]
LEFT JOIN [OBJECT_VALUES] AS ov ON
ov.[OBJECT_ID] = o.[OBJECT_ID]
LEFT JOIN [PAGE] AS p ON o.[PAGE_ID] = p.[PAGE_ID]
INNER JOIN [USERS] as u on u.[USER_ID] = o.LAST_MODIFIED_BY INNER JOIN [PAGE_TEMPLATE] as t
on o.[PAGE_TEMPLATE_ID] = t.[PAGE_TEMPLATE_ID] INNER JOIN [site] as s on t.SITE_ID = s.SITE_ID
WHERE
s.SITE_ID = '34' --AND сont.[FILTER_VALUE] is null--like '%fff%'
效果很好,直到我删除评论。
这是一团糟的连接,但它仍然有意义。我inner join
与其他几个主表,并且left join
可选,所以,我有一个列,其中包含cont.FILTER_VALUE as filter
,它在某些记录中为空,我可以得到它,但我不能按这个字段过滤。
我明白了The multi-part identifier "сont.FILTER_VALUE" could not be bound.
我浏览了类似的主题,但没有找到有用的信息。我不使用任何旧的 SQL 方言:在任何地方我都使用INNER/LEFT
连接,尝试过group by
,order by
尝试重新排序连接 - 没有任何帮助。我想我只是不明白关于连接的重要内容,请你告诉我。
谢谢。