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 9171553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:10:43+00:00 2026-06-17T16:10:43+00:00

On a product page I have a dropdown that lists current colour options associated

  • 0

On a product page I have a dropdown that lists current colour options associated to product page.

In this example, the product page SKU is 250E and it available in:

GREEN
BLACK

If the customer selects GREEN, then I want to run a MySQL command that will change the data to show GREEN values first based in the custom_order value shown below.

The start value should overide the other data items and then it should retain custom_order values. The custom_order field has letters like c1, c2 (they will always be at the bottom)

Colour Table
============
ID      COLOURID        NAME
-------------------------------------
2           5           BLACK
3           6           GREEN


Product Table
=============
ID      SKU         PICTURE URL             COLOURID            CUSTOM_ORDER        
-----------------------------------------------------------------
22      250E        cdn_hash_1.jpg          5                   1
23      250E        cdn_hash_2.jpg          5                   2
24      250E        cdn_hash_3.jpg          5                   3
225     250E        cdn_hash_4.jpg          5                   4
226     250E        cdn_hash_5.jpg          6                   5
227     250E        cdn_hash_6.jpg          6                   6
325     250E        cdn_hash_c1.jpg         -                   c1
426     250E        cdn_hash_c2.jpg         -                   c2
527     250E        cdn_hash_c3.jpg         -                   c3

SELECT * FROM products WHERE ORDER BY custom_order DESC

Now, I want to do the following:

SELECT * FROM products WHERE ORDER BY custom_order AND START VALUE = ‘6’

Therefore, no matter what, the c1, c2 remain intact, result would be:

22      250E        cdn_hash_5.jpg          6                   5
23      250E        cdn_hash_6.jpg          6                   6
24      250E        cdn_hash_1.jpg          5                   1
225     250E        cdn_hash_2.jpg          5                   2
226     250E        cdn_hash_3.jpg          5                   3
227     250E        cdn_hash_4.jpg          5                   4
325     250E        cdn_hash_c1.jpg         -                   c1
426     250E        cdn_hash_c2.jpg         -                   c2
527     250E        cdn_hash_c3.jpg         -                   c3
  • 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-06-17T16:10:44+00:00Added an answer on June 17, 2026 at 4:10 pm

    This is the answer I was looking for. I hope I am not downvoted for this but I managed to resolve this.

    Let me explain again simpler terms. MySQL ORDER BY + Start with..

    MySQL:
    
    id | name  |
    ------------
    1  | Joe   |
    2  | Craig |
    3  | Shawn |
    4  | Ryan  |
    5  | Seth  |
    

    PHP:

    $a = mysql_query("SELECT * FROM table_name ORDER BY name DESC");
    

    what I want to do though is, I want to start at id: 3, so it should output:

    3,4,5,1,2
    

    Solution 1

    SELECT id, name
    FROM table_name
    ORDER BY id < 3, id
    

    Result:

    3  Shawn
    4  Ryan
    5  Seth
    1  Joe
    2  Craig
    

    Solution 2

    You can use FIELD, eg

    SELECT * 
    FROM products 
    ORDER BY FIELD(`order`, 6) ASC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a shopping cart that displays product options in a dropdown menu and
I currently have a product view page that contains an MVCContrib HTML Grid with
I have a website that has products list page and product detail page .
I have a page that will have a full size product image and 4
I have an edit page with url example.com/product/edit/11 Now if the validation is false
In a Master page, I have this.... <ul id=productList> <li id=product_a class=active> <a href=>Product
Suppose that I have an ASP.NET page, where a customer can select a product
I have an infinite scroller for a product page which works well. For SEO
I have the following URL which links to the product page of a Mac
I have a product listing page and want to load up a detail view

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.