select BankCode , sum(TxnNum) from BasicDataPerDayOnBank_II
Where OBcbFlag='Rcv'
and OalId='A2'
and Rspcode='30'
and Datemsg like '200301%'
and InExCode='Intra'
and TxnCode in ('PCA','PPT','ACP','APT','ATZ','ATC')
and Left(BankCode,6) in ('080313','080402')
Group by BankCode , Rspcode
order by BankCode,Rspcode
可以用
select BankCode , sum(TxnNum) from BasicDataPerDayOnBank_II
Where OBcbFlag='Rcv'
and OalId='A2'
and Rspcode='30'
and Datemsg like '200301%'
and InExCode='Intra'
and TxnCode in ('PCA','PPT','ACP','APT','ATZ','ATC')
and Left(BankCode,6) in ('080313','080402')
AND Rspcode in (12,14,30。。。)
Group by BankCode , Rspcode
order by BankCode,Rspcode
select BankCode , sum(TxnNum) from BasicDataPerDayOnBank_II
Where OBcbFlag='Rcv'
and OalId='A2'
and Rspcode='12'
and Datemsg like '200301%'
and InExCode='Intra'
and TxnCode in ('PCA','PPT','ACP','APT','ATZ','ATC')
and Left(BankCode,6) in ('080313','080402')
Group by BankCode
order by BankCode
select BankCode , sum(TxnNum) from BasicDataPerDayOnBank_II
Where OBcbFlag='Rcv'
and OalId='A2'
and Rspcode='14'
and Datemsg like '200301%'
and InExCode='Intra'
and TxnCode in ('PCA','PPT','ACP','APT','ATZ','ATC')
and Left(BankCode,6) in ('080313','080402')
Group by BankCode
order by BankCode
select BankCode , sum(TxnNum) from BasicDataPerDayOnBank_II
Where OBcbFlag='Rcv'
and OalId='A2'
and Rspcode='30'
and Datemsg like '200301%'
and InExCode='Intra'
and TxnCode in ('PCA','PPT','ACP','APT','ATZ','ATC')
and Left(BankCode,6) in ('080313','080402')
Group by BankCode
order by BankCode