• Log In
  • Register
  • Notifications
Skip to content
  • Pods
  • About
  • Docs
  • Blog
  • Support
  • Donate
Pods Docs
Pods Docs
  • Videos
  • FAQs
  • Code Snippets
  • Tutorials
  • Code Reference

Sorting Numeric Fields Using CAST

Sort Numbers (Currency and others) using CAST

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)

Documentation » Searching, Filtering & Sorting » Sorting » Sorting Numeric Fields Using CAST

When using SORT on a Numeric field, the numbers in Post Meta are stored as LONGTEXT so you need to cast them as numbers first.

CAST( product_page_weight.meta_value AS SIGNED ) DESC

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)

 Documentation Information

DRAFT

This page is in DRAFT or is a STUB Document and is pending contribution. We apologize for any inconvenience that may cause.
Created: December 09, 2016
Last Updated: July 25, 2017
Age: 1319 days ago
Context: Search & Finding 
Skill Level: Beginner Developer Themer 
Keywords: cast numeric fields 
Authors: Jim True

Related Content

  •   Related Docs
    • Using Date based Searches

Was this helpful?

  • Get Support!

  • We're sorry to hear you still have questions. Please check out our Support Website for proper escalation for getting support help.

    Get Support

  • Update Documentation

  • Please be as specific as possible. If you found errors, let us know what we can do to correct them. If you feel the documentation could be clearer, please tell us what to do to make it as clear as possible. Your input will help us keep our documentation up to date!
  • We won't spam you or share your email address with anyone else, but we need this in case we have any additional questions.
  • This field is for validation purposes and should be left unchanged.

We make it easy to manage your custom content types, enhance them with custom fields and taxonomy, connect them together with relationship fields and so much more.

Grow Beyond Posts & Pages with Pods, a Content Development Framework for WordPress.

The Pods Team

  • SKC Development, LLC, Project Lead DeveloperSKC Development, LLC from SKC Development, LLC
    Project Lead Developer
  • Jory Hogeveen, Contributing DeveloperJory Hogeveen from Keraweb
    Contributing Developer
  • Jim True, Community Support LeadJim True from Rocketgenius, Inc.
    Community Support Lead
  • Bernhard Gronau, Contributing Developer & Community SupportBernhard Gronau
    Contributing Developer & Community Support
  • Nic Ford, Community SupportNic Ford
    Community Support
  • James Golovich, Contributing DeveloperJames Golovich
    Contributing Developer

Learn about the Team at Pods

RSS Recent Blog Posts

  • Pods 2.8 Beta 1 Released and the Field Guide to Pods 2.8 February 11, 2021
  • Introducing: Pods Pro by SKCDEV, Pods 2.8 in QA, & New YouTube Videos January 1, 2021

Special Thanks

We could not have survived for 10 years without all of the help from the following people.

  • Phil Lewis, Contributing DeveloperPhil Lewis
    Contributing Developer
  • Josh Pollock, Contributing DeveloperJosh Pollock from CalderaWP
    Contributing Developer
  • Nikhil Vimal, Intern DeveloperNikhil Vimal
    Intern Developer
  • David Cramer, Contributing DeveloperDavid Cramer
    Contributing Developer
  • Dan Stefan Oprean, Contributing DeveloperDan Stefan Oprean
    Contributing Developer
  • Mike Green, Contributing DeveloperMike Green from Fifth Room Creative
    Contributing Developer
  • Jonathan Christopher, Contributing DeveloperJonathan Christopher from Iron to Iron
    Contributing Developer
  • Matt Gibbs, Founding Developer: Pods 1.xMatt Gibbs
    Founding Developer: Pods 1.x

Most Popular Docs

  • Magic Tags
  • Special Magic Tags
  • Using Magic Tags
  • What kind of a Pods User are you?
  • Template Tags

Hosting Generously Provided by WPEngine

Powered by
© 2008-2021 Pods Framework, Inc. All rights reserved.