Extract the sum price times quantity for all orders broken down employee
Chapter 5 ■ Using sQL in exCeL
1. Enter the following SQL statements, as shown in Figure 5-12, to extract the sum of price times quantity for all orders broken down by employee. Click Validate to make sure that the SQL statement is entered correctly.
Select employees.[last name], sum([order details].[unit price] * [order details]. quantity) from employees, orders, [order details] where employees.id=orders.
Figure 5-12. SQL query
2. Note that two relationships are used to link three tables, based on the
relationships shown in Figure 5-3. No fields are displayed from the orders table, but that table is used as a link table. The following are the relationships from Figure 5-3 that are being used in this example. Click Finish to execute the SQL statement.