public List<Item> generateTopSellersReport(Date d, int n) throws SQLException{
		List<Item> items = new ArrayList<Item>();
		
		PreparedStatement ps = con.prepareStatement
				("SELECT * FROM " +
				"(SELECT title, company, item_stock, SUM(quantity) AS sold " +
				"FROM Item I, Purchase P, PurchaseItem PI " +
				"WHERE I.upc = PI.upc AND P.receiptid = PI.receiptid AND P.purchase_date=?" +
				"GROUP BY item_stock, title, company " +
				"ORDER BY sold DESC) " +
				"WHERE ROWNUM<=?");
		
		java.sql.Date jday = new java.sql.Date(d.getTime());
		ps.setDate(1, jday);
		ps.setInt(2, n);
		
		// go through the result, creating Items and adding them to the list
		ResultSet rs = ps.executeQuery();
		while (rs.next()) {
			String title = rs.getString("title");
			String company = rs.getString("company");
			int stock = rs.getInt("item_stock");
			int qtySold = rs.getInt("sold");
			
			Item i = new Item();
			i.setTitle(title);
			i.setCompany(company);
			i.setQuantity(stock);
			i.setQtySold(qtySold);
			
			items.add(i);
		}
		
		return items;
	}