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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:02:49+00:00 2026-06-15T11:02:49+00:00

there are 2 mysql table like this table 1 –id—–config_name –1—–OS –2—–Control Panel –3—–Bandwidth

  • 0

there are 2 mysql table like this

table 1

–id—–config_name
–1—–OS
–2—–Control Panel
–3—–Bandwidth

table 2

id — config_id— config_Option_name — Price
1——–1————-Windows 2008——–20.00
2——–1————-CentOs 5—————-0.00
3——–2————-whm/cPanel———–30.00
4——–2————-Plesk——————-50.00


Now I want to show them like this, ONLY USING MYSQL.

  1. OS

    Windows 2008 = 20.00

    CentOs 5 = 00.00

  2. Control Panel

    whm/cPanel= 30.00

    Plesk = 50.00

IS THIS POSSIBLE? So now “os” or “control panel” are selected once although if we use group by or join it comes twice.

Using single SQL statement

  • 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-15T11:02:50+00:00Added an answer on June 15, 2026 at 11:02 am

    Don’t use SQL to format output like this. You should do it on a client side.

    Anyway here is a query to do it in SQL only (SQLFiddle demo):

    select cfgN from
    (
       select concat('\t',
                     CONFIG_OPTION_NAME,
                     '=',FORMAT(Price, 2) ) as cfgN, 
                     config_id,
                     t2.ID,
                     CONFIG_OPTION_NAME,
                     Price 
       from Table2 t2
       join Table1 t1 on (t2.config_id=t1.id)
    
       union all
    
       select concat(cast(id as char),
                     '. ',CONFIG_NAME) as cfgN, 
              id config_id,
              null ID,
              CONFIG_NAME, 
              null Price 
       from table1 
    
    ) t3 order by config_id,id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a t_class table in mySql, in this table there are 3 columns,
I have a MySQL Table that looks like this: The SQL to create the
I have a MySQL table that looks something like this: |---ID---|---COUNTER---| | 1 |
Suppose I have a MySQL table called MyTable, that looks like this: +----+------+-------+ |
I have a MySQL table that looks something like this: +--------------------------------------+ | id |
I have a MySQL table for storing details of uploaded files, like this: CREATE
I have a MySQL table like this: CREATE TABLE categories ( ID INT NOT
I have a mysql table like this: I'm trying to get a list of
Suppose I have a simple MySQL table that looks like this: CREATE TABLE `my_table`
I have a simple MySQL table like this: create table `users`( `id` int(5) NOT

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.