将数据从一个表转移到另一个表

我需要有关我的sql代码的帮助,有没有一种方法可以将数据从第一个SELECT语句的“ AS小计”传输到第二个SELECT语句的“ receipt.totalAmount”。我尝试使用sql进行一些新的在线查找,但没有找到任何解决方案。我无法声明从第一个SELECT语句到第二个SELECT语句的小计。还可以将所有小计加到总计列中吗?

SELECT productServices.productId, productServices.proPrice, orders.orderId, orders.quantity, productServices.proPrice*orders.quantity AS subtotal , orders.dateOrdered
FROM productServices
JOIN orders
ON productServices.productId=orders.productId



SELECT receipt.receiptNo, receipt.customerId, receipt.orderId, receipt.employeeId, receipt.totalAmount, receipt.paymentMethod, receipt.dateOfPurchase
FROM receipt
JOIN customerInfo ON customerInfo.customerId=receipt.customerId
JOIN employeeInfo ON employeeInfo.employeeId=receipt.employeeId
JOIN orders ON orders.orderId=receipt.orderId