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
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:
You should modify it to best fit your biz logic, such as using a LIKE statement.