mysql - How does the ORDER BY CASE Clause Work in the following Code? -


how part of code work?

order    case when subject in ('chemistry','physics') 1 else 0 end,    subject,    winner; 

first checks if subjet chemistry or physics. if sorting score 1.

if subject not contain of "chemistry" or "physics" score 0.

after sorts results score results contains chemistry or physics come first after dont contain.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -