第一个比第二个性能高。
查询语句意义:
如果codelist中tablecode配置为0时, t.Table_Code = 'SV_RETURN_BILL'不生效。 如果codelist中tablecode配置为1时
条件t.Table_Code = 'SV_RETURN_BILL'生效
SELECT *
FROM Sm_Affix t
WHERE t.Record_Id = 865904162
AND (t.Table_Code = 'SV_RETURN_BILL' OR
(SELECT COUNT(*)
FROM Ad_Lov_Code_v t
WHERE t.List_Code = 'SM_AFFIX'
AND t.Lov_Code = 'TABLECODE'
AND t.Lov_Name = '') = 1); SELECT *
FROM Sm_Affix t
WHERE t.Record_Id = 865904162
AND (t.Table_Code = 'SV_RETURN_BILL' OR
(SELECT t.Lov_Name
FROM Ad_Lov_Code_v t
WHERE t.List_Code = 'SM_AFFIX'
AND t.Lov_Code = 'TABLECODE') = '');