I have a column name 'Code' in my database and it contain different numbers like this..
Product | Code
===============================
p1 | 0
p2 | 120
p3 | 0
p4 | 222
p5 | 1
p6 | 1
p7 | 180
p18 | 300
I want to sort table, order by Code. Products with code '1' comes first, then all the numbers in ASC order, and at the end show Products with code '0'. Like This
Product | Code
===============================
p5 | 1
p6 | 1
p2 | 120
p7 | 180
p4 | 222
p18 | 300
p3 | 0
p1 | 0
Any help for SQL query Thanks?
NULLinstead of 0?