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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:47:04+00:00 2026-06-08T22:47:04+00:00

I want to covert the result row from the select query into a comma-separated

  • 0

I want to covert the result row from the select query into a comma-separated string. I have table in which there are 153 columns. the select query is like as follow

SELECT * FROM mytable where id = 3

I want all the resulting 153 columns of a row in a comma-separated string. Is there any trick in MySql?

  • 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-08T22:47:06+00:00Added an answer on June 8, 2026 at 10:47 pm

    You can use GROUP_CONCAT function to do that.

    SELECT GROUP_CONCAT(col1, col2,..coln) FROM my_table;
    

    EDIT:

    get all column names with following query and the substitute that in CONCAT_WS function::

    SELECT GROUP_CONCAT(COLUMN_NAME) 
    FROM information_schema.COLUMNS 
    WHERE TABLE_NAME = 'my_table';
    
    SELECT CONCAT_WS(',', col1, col2, ..., coln) 
    FROM my_table;
    

    or try:

    SET @query1 = CONCAT('
            SELECT CONCAT_WS(",", ',(SELECT GROUP_CONCAT(COLUMN_NAME)
                                     FROM information_schema.COLUMNS
                                     WHERE TABLE_NAME = 'my_table'),')
            FROM    tablew_name'
            );
    PREPARE stmt FROM @query1; EXECUTE stmt; DEALLOCATE PREPARE stmt;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data table and I want to select all distinct names from
I have a table containing columns date_trans, time_trans, price. After select query, I want
I have a query which will return one row. Is there any way I
My problem is, when I want to convert (result[i].JobOrder) to int.I have a string
I have a GridView containing records from a table which can be deleted or
I want to convert my array value into $row in CodeIgniter, result of Array()
I want to convert my date (which is in String format), e.g. 13-09-2011, into
I have an old mysql code which I want to convert into PHP data
I have time in NSString like 15:15 I want to covert this NSString time
I have a static csv file. I want to covert all the data in

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.