Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6993541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:46:40+00:00 2026-05-27T19:46:40+00:00

Below is a preview of what I have so far: MySQL Table: What I

  • 0

Below is a preview of what I have so far:

enter image description here

MySQL Table:

enter image description here

What I want to do is be able to sort this in a certain way. I would like for all rows that are “FREE” to be at the very top, so where special_price is equal to 0.00.

I also would like all rows with a special to be after that, and then all rows with just a normal price would be after that. Is there any way to do that without specifying a sort_id so the user wouldn’t have to change the order themselves?

So in the above example, the last field “Testing” would be moved up one, and “Replace Air Filter” would be last.

Right now in my query there is no ORDER BY, so it is ordering by the id.

Any help is appreciated. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:46:41+00:00Added an answer on May 27, 2026 at 7:46 pm
    ORDER BY COALESCE(special_price,99999) ASC, price ASC
    

    should do the trick.

    Explaination

    COALESCE is a function that takes the first non-null value, so anywhere you have a null special price, it will default to 99999 (just some arbitrary high number to get it at the end of the ordering). From there we order on price, so any ties, as well as the end of the list, will be in ascending order by price.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below is a preview of what I have. What I want to do is
Simple way to make a preview of a textarea? the code i have below
My Question: I want a way to take the preview content (see image below)
Below is the code from a plugin I use for sitemaps. I would like
When I have this: @using Orchard.Themes.Models @using Orchard.Themes.Preview @using Orchard.Themes.Services @using Orchard.Themes.ViewModels @{ Script.Require(OrchardTinyMceDeluxe);
in my script, I have a select-field: <select name=src[jumpMenu] id=jumpMenu onchange=ChangeImage(this.value,'preview');> <option value=A>AStyle</option> <option
In the picture below I have defined a 6-row table layout and placed controls
I have many li elements in an ul list like below: <li id=filesOrderArray_dynamic_number>> <a
I have a UIImageView that contains an image of a circle. I would like
I have a tableview that has groups. I would like to add a dummy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.