## 28.5 Case Study: Accessing an Invoice Database (cont.)

- Compute amt due:

  > `string query = "SELECT SUM(Item.Quantity * Product.Unit_Price) "
  > "FROM Item, Product WHERE Item.Invoice_Number = '"
  > + invnum + "' AND Item.Product_Code = Product.Product_Code";`

  Yields a single row w/a single field

- Extract value, convert:

  > `MYSQL_ROW row = mysql_fetch_row(result); double amount_due = string_to_double(row[0]);`

prev |top |next