Getting Started with Adobe After Effects - Part 6: Motion Blur
Ask
Ask questions, discuss or help others by answering
Related Posts · View All
SQL Server 141
TSQL 75
SSRS 70
SSIS 66
XML 54

Top Categories · View All
SQL Server 141
TSQL 75
SSRS 70
SSIS 66
XML 54

Case Statement Query

Feb 5 2011 12:00AM by dada   

Could you help with this one?

In the case statement below i an getting only data for the first two case statement, and the last 3 statements are suppressed.

But when i put the second case statement in the end(i.e 'Total FEW') i am getting value for the first four condition and only the 'Total FEW' condition is suppressed.

Pls give a advise/solution!

    
Case 
    When T2.A = 'CANADA'	
		and T2.B in ('TRANSACTION FRAUD', 'IDENTITY FRAUD', 
			'INVESTIGATIONS') 
		Then 'Canada'
    When T2.B <> 'OTHER' 
		Then 'Total FEW'
    When T2.A in ('BANK CARD EAST', 'BANK CARD WEST', 
			'CANADA', 'CHOICE', 'DEBIT', 'DEBIT EAST', 
			'DEBIT WEST', 'OTHER') 
		and T2.B in ('SMITH BARNEY', 'SPECIALTY', 
			'BOARDROOM', 'DOSS') 
		Then 'DOSS'
    When T2.A in ('BANK CARD EAST', 'BANK CARD WEST', 
			'CHOICE', 'CANADA', 'OTHER') 
		and T2.B = 'IDENTITY FRAUD' 
		Then 'ID Fraud'
    When T2.A in ('BANK CARD EAST', 'BANK CARD WEST', 
			'CHOICE', 'OTHER') 
		and T2.B = 'TRANSACTION FRAUD' 
		Then 'Trans Fraud'
End Department,

Submitted under: Microsoft SQL Server · TSQL ·  ·  · 


dada
1554 · 0% · 12

3 Replies

  • Post some sample data with expected result

    commented on Feb 7 2011 1:11AM
    Madhivanan
    3 · 39% · 12419
  • the result which you are getting is correct. because first it will verify the conditions it matches the criteria then it will display the result of that condition. in your case it is stopping at case 2 by suppressing other 4 because the data which you have is satisfying the case 2(i.e t2.b <>'other'). and if you keeping the case 2 at last then any of the 4 conditions are satisfying and that is the reason you are not able see 'Total few'. you may need to check the conditions which you are using here.

    commented on Feb 13 2011 1:12AM
    chakkajkumar
    1554 · 0% · 12
  • Agreed with chakkajkumar. The CASE statement will stop processing conditions as soon as one of them evaluates to be true. So if the first condition evaluates to be true, then the rest of the conditions will not be processed/evaluated.

    In your case, the condition 2 looks for values that are 'not equal to OTHER'. So the rest of the conditions will be processed only if column B contains value 'OTHER'

    commented on Aug 15 2012 5:34AM
    Jacob Sebastian
    1 · 100% · 32002

Your Reply


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]