MySQL Forums
Forum List  »  Newbie

Order By based on IF()
Posted by: Jordan Pritt
Date: July 21, 2017 02:32PM

Say you query x,y,and z from a MySQL database (obviously) and you have a few IF() blocks inside your where clause. If one wanted to change the ORDER BY based on which whether or not the query came from the true or false how would one go about doing so?

For example say if the query resolved in the IF() as being true ORDER BY is LIMIT 3 but if the IF() resolved to false ORDER BY LIMIT needs to be 2,4 not 3.

Thanks for any advice or tips!

Options: ReplyQuote


Subject
Written By
Posted
Order By based on IF()
July 21, 2017 02:32PM


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.