我基本上想在我有
CASE
语句的下面写一个条件连接,但这会导致语法错误。我基本上只想在OWNING_ENTITY_ID
等于ORGANIZATION_ID
时使用这个连接,否则如果它们不匹配那么我不想加入这个。
SELECT cce.*
FROM INV_TRANSACTIONS cce, SYSTEM_ITEMS DEF
WHERE cce.LOCATOR_ID = DEF.LOCATOR_ID
AND CASE WHEN cce.OWNING_ENTITY_ID = cce.ORGANIZATION_ID
THEN cce.OWNING_ENTITY_ID = cce.ORGANIZATION_ID
END