否则,如果在我的选择声明中

时间:2017-01-29 18:07:11

标签: sql sql-server

如果在我的select语句中我已经尝试过使用案例,但我的结果不是那么准确我想要一个其他的

下载了我的脚本片段

select distinct t.MovementDate, t.ContractMovementID, t.GID,t.ReferenceGID, 
                p.refno, t.amount,convert(date,t.CreatedDate) as createdDat
from 
    LIF_MGM_T_Contract p
    inner join LIF_MMS_T_PolicySuspense s with (nolock) 
        on s.ContractGID = p.GID
    inner join LIF_TMS_T_FinancialTransaction t with (nolock) 
        on t.ContractGID = p.GID
where  
    p.refno = '1030642 - 1 - Mohahlaula' 
    and t.ReversedIndicator = 1
    and t.counter = (select min(counter) 
                     from LIF_TMS_T_FinancialTransaction t2 with (nolock) 
                     where t2.ContractGID = p.GID 
                           and t2.ReversedIndicator = 1 
                           and t2.MovementDate = t.MovementDate )

所以我想要一个其他如果t2.reversedindicator = 0和date = getdate()返回结果..希望这有意义

0 个答案:

没有答案
相关问题