About Ellie

Ellie is a web developer and 6-year veteran of Blogathon from New York. In the past, she has blogged for organizations such as the American Cancer Society, ASPCA, and the Diabetes Research and Wellness Foundation. In 2010, she reached her highest donation amount yet, and hopes raise more money this year and for years to come.

SQL Sort by Specific Field Value

Did you know that you can sort by a specific field value? I didn’t! If you want certain items that have a certain value in a field to show up first, this is what your order by clause should kind of look like:

ORDER BY field(name_of_field,'value1','value2') DESC

If you want an item with a specific value to show up last instead, replace ‘DESC’ with ‘ASC’.