op_sale_statistics.java~4~

来自「基于JSP的网上书店.功能较为全面 开发环境:sql server2000+to」· JAVA~4~ 代码 · 共 48 行

JAVA~4~
48
字号
package bookshop.run;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: </p> * @author not attributable * @version 1.0 */import java.util.*;import bookshop.util.*;public class op_sale_statistics extends DataBase {  ArrayList al=new ArrayList();  public op_sale_statistics() {  }  public ArrayList getSaleNumOrder()  {    String sql="select book.bookname bookname,sum(allorder.amount) num from allorder,book "+               " where allorder.bookno=book.id "+               " group by bookname "+               " order by num desc";           try{                  DataBase db = new DataBase();                  db.connect();                  stmt = db.conn.createStatement ();                  rs=stmt.executeQuery(sql);                  while (rs.next())                  {                    String [] result=new String[2];                    result[0]=rs.getString("bookname");                    result[1]=rs.getString("num");                    al.add(result);                  }                  return al;             } catch (Exception e){               System.out.println(e.getMessage());              return null;             }  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?