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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:10:59+00:00 2026-06-05T04:10:59+00:00

My issue was a missing comma. Feel free to delete this post while I

  • 0

My issue was a missing comma. Feel free to delete this post while I smack my head into the desk

I have a database that has several VARCHAR columns that are actually integers, yet for certain reasons the columns need to be VARCHAR and not INT. Obviously I’m having sorting issues as the numbers

7
8
9
10

Sort as

10
7
8
9

My SELECT statement uses multiple joins and SELECT variables:

SELECT master.column1, table2.column1, table2.column2, table3.column1 FROM master
LEFT JOIN table2
ON master.column1 = table2.column1
WHERE master.column1 LIKE 'whatever'
OR WHERE master.column2 LIKE 'whatever'
ORDER BY master.column1, master.column2, master.column3....

Is there a way to insert the CAST function on just one of the variables?

i.e SELECT master.column1, CAST(table2.column1 AS UNSIGNED), table2.column2....

I haven’t had success trying it as above, and the MySql manual does not give an example that has multiple SELECT or ORDER BY variables.

Thank You

  • 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-05T04:11:02+00:00Added an answer on June 5, 2026 at 4:11 am

    You probably want to use CAST in the ORDER BY clause.

    Select … ORDER BY master.column1, cast(master.column2 as varchar), master.column3….

    Using CAST in the Select Clause only affects output not ordering.

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

Sidebar

Related Questions

Not sure if this is a simulator issue or I am missing something, the
Now I must be missing something here, as this seems a very basic issue
I have a got an issue on SQL Server Database as it is not
I have this seemingly easy issue in FF4. In the code below I need
We've had this issue of getting compiler warnings for XML comments missing on code
I'm having a issue where pod2usage is missing text, and I have tried to
I've been looking at this issue for too long. I suspect I'm missing something
Seems like a simple issue but I'm obviously missing something. I have a ViewBag
I think this is a defered execution issue, but maybe i am missing the
The issue I'm running into is I have an NSMutableArray labeled: _podAllEntries, which contains

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.