简体   繁体   中英

How to sum a column from a query created table

I created a SELECT query, after I execute it, it shows me a new table as I wanted (you can see it in the screenshot).

The problem is that I'm trying to add a new line to the query which supposes to sum() the column "Price" in the table that I got from the query

SELECT SUM(PRICE) AS totalPay 
FROM Meals 

You can see the tables here, and also the queries that worked at that, didn't.

I want it to be like that:

Like this

Just add the SUM(price) as new field in your first SELECT. SELECT SUM(Meals.Price) as 'TotalPay', tableN01.waiterID FROM tableN01 INNER JOIN Meals etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM