MySQL IF ELSEIF in select query

后端 未结 5 1998
無奈伤痛
無奈伤痛 2020-12-22 23:33

I\'m trying to select different prices of a product based on the quantity that user chooses. This is the query I\'m working on (it has a syntax error):

 sele         


        
5条回答
  •  无人及你
    2020-12-23 00:18

    As per Nawfal's answer, IF statements need to be in a procedure. I found this post that shows a brilliant example of using your script in a procedure while still developing and testing. Basically, you create, call then drop the procedure:

    https://gist.github.com/jeremyjarrell/6083251

提交回复
热议问题