因此,我们有一个带有带有错字的子查询的查询。它缺少FROM子句。但是,当您运行它时,它不会出错!为什么!?
SELECT
1
,r.id
,'0D4133BE-C1B5-4141-AFAD-B171A2CCCE56'
,GETDATE()
,1
,'Y'
,'N'
,oldItem.can_view
,oldItem.can_update
FROM Role r
JOIN RoleObject oldReport
ON r.customer_id = oldReport.customer_id
JOIN RoleItem oldItem
ON oldReport.id = oldItem.role_object_id
AND r.id = oldItem.role_id
WHERE r.id NOT IN (SELECT
role_id
WHERE role_object_id = '0D4133BE-C1B5-4141-AFAD-B171A2CCCE56')
AND oldReport.id = '169BA22F-1614-4EBA-AF45-18E333C54C6C'