MySQL Forums
Forum List  »  Newbie

Re: IF Statement - does nesting order matter?
Posted by: Amanda J
Date: November 14, 2017 09:46PM

fixed one of the issues. Corrected query now returns both forms of over-exploited and correctly recognises where unknowns values.

IF(qty_prod = '0', ':', 
	IF(qty_prod < (0.5*max_prod_5),'over-exploited',
			IF(qty_prod BETWEEN avg_prod_5 AND avg_prod_10, 'fully exploited',
				IF(qty_prod >= avg_prod_10 AND area_change_a > '0', 'non-fully exploited',
					IF(qty_prod < max_prod_5 AND area_change_a = '0', 'over-exploited_2', 'F')
FROM fao_aquaculture;

values where qty_prod > avg_prod_5 and avg_prod_10 are not getting categorized.

I need to re-think how I define "catches stabilized at/close to last 5-10 yrs peak values"

Can the true statement have multiple operations listed? Like a series of AND statements for example?

Options: ReplyQuote

Written By
Re: IF Statement - does nesting order matter?
November 14, 2017 09:46PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.