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
Post a Comment