DECLARE @vcFieldName VARCHAR(100)= ‘nMerchantId,nUserId,dmMoney‘ SELECT nMerchantId, nUserId, dmMoney, CASE WHEN CHARINDEX(‘nMerchantId‘, @vcFieldName) > 0 THEN nMerchantId ELSE 0 END + CASE WHEN CHARINDEX(‘nUserId‘, @vcFieldName) > 0 THEN nUserId ELSE 0 END + CASE WHEN CHARINDEX(‘dmMoney‘, @vcFieldName) > 0 THEN dmMoney ELSE 0 END AS dmTotal FROM GM.CRM_Customer
时间: 2025-01-01 20:12:34