Creating a customer list

[CR #440594] In “Creating a customer list” on page 47, the SQL code in step 3c is missing a portion of the where clause (and c.id = s.id). This missing code joins the customer ID in Sales Order with the customer ID in Customer table. Without the clause, the list of orders for each customer is not updated.

The corrected code is:

set rowcount 10
select c.fname as customer_fname , c.lname as customer_lname, si.id,
si.prod_id, p.name, si.quantity
from customer c, sales_order s, sales_order_items si, product p
where c.id =@OP["cust_id"="101"] and s.id = si.id and si.prod_id =p.id
and s.region ='@OP["region"="Western"]'
and c.id = s.cust_id
set rowcount 0