Wednesday, 15 August 2012

sql - Look for count when selecting a variable -



sql - Look for count when selecting a variable -

declare @tmdate datetime ,@nbranchid int select @tmdate = getdate() ,@nbranchid = 3483 select strmessage = case when xpr.frevaluationprice <> d.fupplupenranta d.strinstrument +' in ' + f.strshortname + ' has not been saved. has wrong fixing in xp_results: ' + convert(varchar, xpr.frevaluationprice) + ' should be: ' + convert(varchar, d.fupplupenranta) else '' end dbo.deals d inner bring together dbo.xp_results xpr on 1=1 , xpr.strpaperid = convert(varchar, d.ntransactionid) , xpr.ninstrid = d.ninstrid , xpr.tmdate = convert(datetime, d.strmotpartkikod) --'20140404' inner bring together dbo.folders f on 1=1 , f.nid = d.nfolderid 1=1 , d.nbranchid = @nbranchid , d.ninstrid = 11 , d.ninternaltrans = 3 , d.nindex = 1

is possible somehow check count , else within case? problem one thousand rows selected , mixed up, , wan't see how many of each there is

you can set case within count this

select count(case when xpr.frevaluationprice <> d.fupplupenranta 1 else null end) select count(case when xpr.frevaluationprice <> d.fupplupenranta null else 1 end) from...

sql sql-server tsql

No comments:

Post a Comment