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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:24:48+00:00 2026-05-30T16:24:48+00:00

to get numeric values from an ENUM column, can be using mysql> SELECT enum_col+0

  • 0

to get numeric values from an ENUM column, can be using

mysql> SELECT enum_col+0 FROM tbl_name;

reference here

But in my mysql5.5 console,this query return:

1.0000000000000000000000000000000

I want to get the a integer number 1

I know I can use:

SELECT CONVERT(enum_col,UNSIGNED) FROM tbl_name;

or

SELECT CAST(enum_col AS UNSIGNED) FROM tbl_name;

I want to know why enum_col+0 return a float,

and any other way to get numeric values from an ENUM column?

  • 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-30T16:24:50+00:00Added an answer on May 30, 2026 at 4:24 pm

    Have a look at this article – Type Conversion in Expression Evaluation; it describes how MySQL does conversion between different types; there are some rules, in your case you get result as a floating-point value.

    …and try another variant:

    SELECT TRIM(TRAILING ')' FROM TRIM(LEADING '(' FROM TRIM(LEADING 'enum' FROM column_type))) INTO @enum
      FROM information_schema.`COLUMNS` WHERE TABLE_SCHEMA = 'db_name' AND TABLE_NAME = 'tbl_name' AND COLUMN_NAME = 'enum_col';
    
    SELECT FIND_IN_SET(CONCAT('''', enum_col, ''''), @enum) FROM tbl_name
    

    or this one:

    SELECT REPLACE(TRIM(TRAILING ')' FROM TRIM(LEADING '(' FROM TRIM(LEADING 'enum' FROM column_type))), '''', '') INTO @enum
      FROM information_schema.`COLUMNS` WHERE TABLE_SCHEMA = 'db_name' AND TABLE_NAME = 'tbl_name' AND COLUMN_NAME = 'enum_col';
    
    SELECT FIND_IN_SET(enum_col, @enum) FROM tbl_name
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using SQL Server 2005 I want to get only numeric values from the table
What I'm doing is this: I get a list of ID values (numeric) from
I'm using PDO and MySQL, for some reason when getting values from the database
i am trying to get the 1st 5 largest values from a numeric array...i
I am trying to capture / extract numeric values from some strings. Here is
Possible Duplicate: How to only select numeric data from mysql? Hi, I want to
I have multiple numeric values which I can express as either an array, or
This seems like it should be prettty easy - but I just can't get
I need to pass an array of numeric values from jQuery to a php
I am trying to parse two values from a datagrid. The fields are numeric,

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.