Mysql UNION 2表(组合它们)

Mysql UNION 2表(组合它们),mysql,sql,union,Mysql,Sql,Union,我有产品 Product_ID Product_Name Price Quantity 11 MilkA 36 56 3 21 MeatB 123 78 23 31 SugarA 29 45 333 产品 Product_ID Product_Name Price Quantity 21 MilkB 63 65 33 22 MeatB 321 8

我有产品

Product_ID Product_Name Price Quantity 
11         MilkA 36     56    3
21         MeatB 123    78    23 
31         SugarA 29    45    333 
产品

Product_ID Product_Name Price Quantity 
21         MilkB 63     65    33  
22         MeatB 321    87    4345 
23         SugarB 92    54    232 
我希望像这样选择查询

Product_ID Quantity Quantity*Price
11         36       
21         123
31         29
21         63
22         321
23         92
我试着


但这看起来是无格式的。详细信息

如果您想要两个表的结果,可以使用UNION ALL

SELECT
  a.Product_Id as product_Id, 
  a.Quantity, 
  a.Quantity * a.Price as total
FROM Products_A a
UNION ALL
SELECT
  b.Product_Id as product_Id,
  b.Quantity,
  b.Quantity * b.Price as total
FROM Products_B b

在SQL查询中搜索UNION!谢谢拉斐尔,你忘记了b中的逗号,但这是给未来的访客的。
SELECT
  a.Product_Id as product_Id, 
  a.Quantity, 
  a.Quantity * a.Price as total
FROM Products_A a
UNION ALL
SELECT
  b.Product_Id as product_Id,
  b.Quantity,
  b.Quantity * b.Price as total
FROM Products_B b