郁闷,再搞两天我就挂了。
先说明一下:
从balance_all_info表 得到balance_index;接下来有 balance_conf,balance_voip两周功能的卡,这两种卡的总的消费信息在balance_all_info表中,
若由balance_index查询到conf_index则由conf_index 查询 balance_conf_account卡的信息,
若由balance_index查询到voip_index则由voip_index 查询 balance_voip_account卡的信息,
但结果集是这两个表的汇总(mysqlres和mysqlsubres)。
这下面的程序有没有问题啊,一直得不到我想要的值。还有把这结果集分段显示怎么弄啊。我到时候要分页显示。
网高手朋友不吝赐教。小弟不胜感激之至!
int totalshiyongminxicount;
public int startqueryshiyongminxi(int skipnum,String cardaccount, String starttime,String endtime)
{
int ret=domysqlconn();
if (ret!=0)
{
return -100;
}
try{
String balance_all_query="select balance_index from balance_all_info where card_index="+cardaccount;
substmt=mysqlconn.createStatement();
subres=substmt.executeQuery(balance_all_query);
while(subres.next()){
int balanceindex=subres.getInt(1);
String querybalance_conf="select conf_index from balance_conf where balance_index="+balanceindex;
substmtof1=mysqlconn.createStatement();
subresof1=substmtof1.executeQuery(querybalance_conf);
String querybalance_voip="select voip_index from balance_voip where balance_index="+balanceindex;
substmtof2=mysqlconn.createStatement();
subresof2=substmtof2.executeQuery(querybalance_voip);
if(subresof1.next()){
int confindex=subresof1.getInt(1);
totalshiyongminxicount++;
System.out.println(confindex+"sccoooZZZZZZccs");
String subquery1="from balance_conf_account where conf_index="+confindex+" and start_time>'"+starttime+"' and start_time<'"+endtime+"' and end_time!='0000-00-00 00:00:00'";
String Aquerysql="select card_index,start_time,member_count,sec_to_time(unix_timestamp(end_time)-unix_timestamp(start_time)),'balance_conf_account' "+subquery1;
mysqlres=mysqlstmt.executeQuery(Aquerysql);
mysqlsubstmt=mysqlconn.createStatement();
String querysqlss="select member_number from conf_join_member where conf_index="+confindex;
mysqlsubres=mysqlsubstmt.executeQuery(querysqlss);
}
if(subresof2.next()) {
int voipindex=subresof2.getInt(1);
System.out.println(voipindex+"6666666666");
totalshiyongminxicount++;
String subquery2="from balance_voip_account where voip_index="+voipindex+" and start_time>'"+starttime+"' and start_time<'"+endtime+"' and end_time!='0000-00-00 00:00:00'";
String Bquerysql="select card_index,start_time,member_count,sec_to_time(unix_timestamp(end_time)-unix_timestamp(start_time)),'balance_voip_account' "+subquery2;
mysqlres=mysqlstmt.executeQuery(Bquerysql);
mysqlsubstmt=mysqlconn.createStatement();
String querysqlss="select member_number from voip_join_member where voip_index="+voipindex;
mysqlsubres=mysqlsubstmt.executeQuery(querysqlss);
}
}
System.out.println(totalshiyongminxicount+ "BBBBHPPPPPPPPPHBBBBB");
ret=0;
}catch (Exception e){
System.out.println("Errorss:"+e.toString());
e.printStackTrace();
ret=-10;
}
return ret;
}