If you need to use the quoted price to determine the total, then it's this:CREATE VIEW yourViewASSELECT o.order_num, SUM(l.quoted_price) as order_totalFROM Orders as oINNER JOIN Order_line as lOn l.Order_num = o.order_numGROUP BY o.order_numORDER BY o.order_num;
If you need to use the price then it's this:CREATE VIEW yourViewASSELECT o.order_num, SUM(p.price) as order_totalFROM Orders as oINNER JOIN Order_line as lOn l.Order_num = o.order_numINNER JOIN Part as pOn p.part_num = l.Part_numGROUP BY o.order_numORDER BY o.order_num;
That said, while it's valid to have an ORDER BY clause in a view, it is a good idea in most cases not to. The ORDER BY belongs in the SELECT statement that queries the view.