public static double getTotalSales() {
    String select = "Select SUM( (SELECT price FROM Inventory i WHERE i.mId=s.mId)*s.numSold) As Ttl_Sales FROM Sales s";
    ResultSet allSales = null;
    double totalSales = 0;
    try {
      PreparedStatement sales = con.prepareStatement(select);
      allSales = sales.executeQuery();
      if (allSales.next()) {
        totalSales = allSales.getDouble("Ttl_Sales");
      }
    } catch (SQLException sqlE) {
      totalSales = Double.NaN;
    } finally {
      if (allSales != null) {
        try {
          allSales.close();
        } catch (SQLException ignore) {
        }
      }
    }
    return totalSales;
  }