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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:54:33+00:00 2026-06-01T10:54:33+00:00

Right, this is a very odd issue that I’m wondering how i am going

  • 0

Right, this is a very odd issue that I’m wondering how i am going to explain it succinctly.

I have a WP plugin that records rows in a mysql table like so:

meta_id    post_id    meta_key    meta_value 
65387      605        _likes      9 

Then on one of my pages I was running a query to select the most liked posts, ie. ORDER by meta_value DESC. Now i noticed on my site that whenever a post reached 10 it would not appear as top anymore and disappear from the query results. Odd.

I went to the database and (in PHPMyAdmin) ordered by meta_value and it did return 9 as the top results, none of the 10’s appeared!?

One thing I thought it might be is the type of field (meta_value), these are the settings:

#   Column      Type        Collation           Attributes  Null    Default
4   meta_value  longtext    latin1_swedish_ci               Yes     NULL    

Can anyone think of anything that might mean the ORDER BY is not working when the value is 10 or above!?

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-06-01T10:54:34+00:00Added an answer on June 1, 2026 at 10:54 am

    If you can’t change column datatype don’t worry … No need to do that

    you need to just cast it’s values in integers in ORDER BY clause.

    user trick :

    ORDER BY meta_value+0;
    

    OR

    ORDER BY CAST(meta_value as SIGNED);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hope I can explain this right I have two input fields that require
Right, this is an odd one. We have a web service that returns data
Ok, so this is very odd. I have a site that I am breaking
I've got this very odd bug that appears to be a quirk in Visual
I have a very odd problem where live wallpapers will not work right on
I have this right now: <%= f.select :credit, (0..500) %> This will result in
Do I have this right ... // Reactor.h @property(nonatomic, retain) NSMutableArray *reactorCore; // Reactor.m
I never seem to get this right. I've got a method that returns a
I'd like to right align this gridview so that it's flush against the right
I have a very large array of doubles that I am using a disk-based

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.