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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:49:05+00:00 2026-05-25T12:49:05+00:00

Is it possible to rename a result in MySQL? For example if I have

  • 0

Is it possible to rename a result in MySQL? For example if I have the following table

Pizza                     Topping 
--------------------------------
Cheese                    Olives 
Ham                       Tuna
Four cheese               Olives
Cheese                    Tuna

How can I do a select pizza so that cheese and four cheese are returned as the same? For example if i wanted to obtain a count of the different pizzas, I would get

Ham = 1
Cheese = 3

I want to perform a query such as

select pizza, count(*) from pizza_table
group by pizza

And the result should be:

Pizza                     count(*)
--------------------------------
Cheese                    3
Ham                       1

instead of

Pizza                     count(*)
--------------------------------
Cheese                    2
Ham                       1
Four cheese               1
  • 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-25T12:49:06+00:00Added an answer on May 25, 2026 at 12:49 pm

    Sure. Use the CASE/WHEN statement in your SELECT to evaluate and modify. See doc MySQL here. And some practical examples here to get you started.

    This sample really naive but ought to be close:

    SELECT 
       CASE Pizza
          WHEN 'Cheese' THEN 'Cheese'
          WHEN 'Four Cheese' THEN 'Cheese'
          WHEN 'Extra Cheese' THEN 'Cheese'
          ELSE Pizza
       END AS PizzaType,
       COUNT(*) as PCount
    FROM PizzaTable
    GROUP BY PizzaType
    

    You should modify it to best fit your biz logic, such as using a LIKE statement.

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

Sidebar

Related Questions

Is it possible to rename a MySQL table? If so, how?
Is it possible to rename file when trying to download it? For example, I
Is it possible to rename/refactor a class file and have it rename the actual
isn't it possible to rename tags within the app.config? If I use the following
I have a simple example: #include <stdio.h> #include <errno.h> int main() { int result
is possible to rename the node title using the value from the java script
Is it possible to rename all the tabs in a jQuery UI tab control?
Is it possible to rename a list in Sharepoint 2007 using the web interface?
Is it possible to rename a report section in a crystal reports using the
Is It possible to rename hosted service of windows azure? I created it with

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.