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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:18:38+00:00 2026-06-16T22:18:38+00:00

I am not an expert in SQL therefore need your help. I have this

  • 0

I am not an expert in SQL therefore need your help.

I have this advanced query written by someone else:

SELECT cms_product_bid.*,
    cms_products.*,
    cms_products_images.pd_image, 
    cms_products_images.pd_image_label,
    IF (cms_product_bid.pd_bid = 1,
        IF(cms_product_bid.pd_bid_start_date <= CURDATE(),
            IF(cms_product_bid.pd_bid_end_date >= CURDATE(),1,0)
        ,0)
    ,1)  AS bid_product_check
FROM cms_products
LEFT JOIN cms_products_images 
ON (cms_products.pd_id = cms_products_images.pd_id)
INNER JOIN cms_product_bid 
ON (cms_product_bid.product_id = cms_products.pd_id)
INNER JOIN cms_home_product_slider 
ON (cms_products.pd_id = cms_home_product_slider.pd_id)
WHERE cms_products.pd_status=1 
    AND cms_products.pd_visibility=1 
    AND cms_home_product_slider.cat_id='$featured_cat_id'
GROUP BY cms_products.pd_id 
HAVING(bid_product_check =1)
ORDER BY cms_products.pd_sort ASC

All I am trying to do is to sort by cms_products.pd_sort but it isn’t sorting by that column even though column is there in table with values such as 1, 2 and so on.

Can anyone point out the issue here ?

  • 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-16T22:18:40+00:00Added an answer on June 16, 2026 at 10:18 pm

    my guess is that your column is of type VARCHAR or string, you can simply CAST it

    SELECT...
    FROM...
    WHERE...
    ORDER BY CAST(cms_products.pd_sort AS SIGNED) ASC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am not expert in sql and I need help with the following query.
I'm not an expert with either System.Data nor SQL Server, but have a need
I am not an expert in Git, but I have seen this done before
I am not an expert in sql / sqlite.. suppose we have two tables:
I am not an expert on SQL, so I am asking here some help
I am not an expert on SQl Server. Is this a valid pattern for
I'm not a SQL expert (by any means). I know I can do this
I'm not an SQL expert, here is my SQLite query on table Query (key:
To anyone who can help. I am not an expert at T-SQL so I
To anyone who can help. I am not an expert at T-SQL so I

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.