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

  • Home
  • SEARCH
  • 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 6797245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:35:08+00:00 2026-05-26T18:35:08+00:00

This mysql query doesn’t seem to work for me: select * from myTable order

  • 0

This mysql query doesn’t seem to work for me:

select *
from myTable
order by
  find_in_set( category, "First, Second" ),
  sortby,
  title;

Apparently you can’t order beyond the find_in_set function?

Is there a way around this? Am I missing something?

Thanks for your reply.

Edit:

This is the exact query being run:

select
  uid,
  category,
  title,
  summary,
  image_url,
  link_url,
  link_text
from links_and_documents
where link_url != ''
  and status=1
order by
  find_in_set( category, "Test_Category_Two,Test_Category_One" ),
  sortby,
  title;

It returns all the items you would expect but orders them by sortby and completely ignores the find_in_set function.

If I leave ,sortby,title off the end of the query it sorts items by the find_in_set function.:

select
  uid,
  category,
  title,
  summary,
  image_url,
  link_url,
  link_text
from links_and_documents
where link_url != ''
  and status=1
order by
  find_in_set( category, "Test_Category_Two,Test_Category_One" );

Thanks for taking a look.

Table Structure:

CREATE TABLE `links_and_documents` (
  `id` int(11) NOT NULL auto_increment,
  `dateadded` varchar(19) NOT NULL default '',
  `dateupdated` varchar(19) NOT NULL default '',
  `uid` varchar(16) NOT NULL default '',
  `clientuid` varchar(16) NOT NULL default '',
  `status` char(1) NOT NULL default '1',
  `sortby` varchar(16) NOT NULL default '',
  `category` text NOT NULL,
  `title` text NOT NULL,
  `information` text NOT NULL,
  `summary` text NOT NULL,
  `services` text NOT NULL,
  `link_url` text NOT NULL,
  `link_text` text NOT NULL,
  `document_url` text NOT NULL,
  `document_text` text NOT NULL,
  `image_url` text NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `uid` (`uid`),
  KEY `category` (`status`,`category`(30))
)

I receive no errors.

  • 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-26T18:35:08+00:00Added an answer on May 26, 2026 at 6:35 pm

    I was running into the same problem from several months:

    order by find_in_set( category, "First, Second" )
    

    use to work sometimes and sometimes NOT.
    Today I read a lot and the next change solved my problem:

    ORDER BY FIELD( category, 'First', 'Second' )
    

    Hope it’s not too late to help you.

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

Sidebar

Related Questions

This query doesn't complete in a reasonable amount of time: mysql> select * from
This query doesn't work SELECT * FROM Catalogue WHERE Catalogue.ID IN ( SELECT ID_catalogue
Why doesn't the CAST work in this MySQL query? SELECT MAX(Signups) AS Max, MIN(Signups)
I'm having this Mysql query, It works: SELECT nom ,prenom ,(SELECT GROUP_CONCAT(category_en) FROM (SELECT
The original query looks like this (MySQL): SELECT * FROM books WHERE title LIKE
This is my code: $query = mysql_query(SELECT * FROM books ORDER BY id) or
I have this MySql query: SELECT YEAR(date), MONTHNAME(date), SUM(block_time) FROM flights WHERE operator =
This MySQL-Query: SELECT * FROM table_1 t_1 WHERE t_1.title_search IN ( SELECT title_search FROM
mysql_query(SELECT * FROM foo WHERE id ='$foo' OR id = '$foo2); This doesn't work.
say I have this $result = mysql_query('SELECT views FROM post ORDER BY views ASC');

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.