php - Mysql Case Syntax -


select * case_study order case when expiry_date_case > curdate() 1 end when expiry_date_case null 2 desc end when expire_date_case < curdate() 3 desc end; 

when trying run query getting error

#1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'when expiry_date_case null 2 desc end when expire_date_case < curdate() ' @ line 4


where doing wrong?

try

select * case_study order case when expiry_date_case > curdate() 1  when expiry_date_case null 2  when expire_date_case < curdate() 3 end desc 

you have many end's , many desc's


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -