The following form should complete the following task:
SELECT SUM(cost) FROM ( SELECT cost FROM sandwiches WHERE name = "Cheese Steak" UNION SELECT cost FROM pizza WHERE TYPE = "Plain" AND SIZE = "L" ) as temp
MySQL only requires a temporary table name for a subquery.
source share