I have two excel databases. first one is database:
Sl_no Species State District Local_equation General_equation Specific_gravity
1 Cassia fistula Uttrakhand Haldwani 0.16019-2.81861*D+16.9328*D*D (-0.046597*H)^1/2 0.74
2 Shorea robusta Uttrakhand Almora (-0.046597+2.227173*D)^1/2 (-0.046597*D)^1/2 0.48
and second one is Field_Data_1 and it contains two sheets: Plot and Data this is Plot sheet:
Plot_ID Latitude Longitude Altitude Location District State PlotSize_ha Date P1 37.6 40.6 640 Barkot RF, South from flux tower Dehradun Uttrakhand 0.1 31.05.2014
this is data sheet:
Plot_ID Sl_no Species Gbh_cm Height
P1 1 Cassia fistula 13 1
P1 2 Shorea robusta 206 7
Using select query I want to display the names of those species whose district and state does not match with the second and third one.I dont have any idea which qquery to use. I have done this much till now.
if(selected1.contains(tmp1))
{
sql10 = "select * from [Plot$],[Data$] where [Data$].Plot_ID = ? ";
pst10=con.prepareStatement(sql10);
pst10.setString(1, tmp1);
rs14=pst10.executeQuery();
while(rs9.next() && rs14.next())
{
HSSFRow row=sheet.createRow((short)i);
st=rs14.getString("State");
dis=rs14.getString("District");
sp=rs9.getString("Species");
sql11="select * from [database$] where State = ? and District = ? and Species = ?";
pst11=con1.prepareStatement(sql11);
pst11.setString(1, st);
pst11.setString(2, dis);
pst11.setString(3, sp);
rs15=pst11.executeQuery();
//if(rs15.next())
//{
while(rs15.next())
{
System.out.println(sp);
gbh=rs9.getDouble("Gbh_cm");
gbh1=RoundTo2Decimals(gbh);
gbhm=gbh/100.0;
gbhm1=RoundTo2Decimals(gbhm);
diameter=gbh/3.14;
diameter1=RoundTo2Decimals(diameter);
diameterm=diameter/100.0;
diameterm1=RoundTo2Decimals(diameterm);
System.out.print(gbh1+" ");
System.out.println(diameter1);
exp2=rs15.getString("Local_equation");
System.out.println(exp2);
//System.out.println(exp2);
String ss=Double.toString(diameterm1);
String regex="D";
String strrep=exp2.replaceAll(regex,ss);
System.out.println(strrep);
d2=eval(strrep);
d21=RoundTo2Decimals(d2);
System.out.println("Volume is:"+d21);
sg=rs15.getDouble("Specific_gravity");
System.out.println(sg);
biomass=d21*sg;
biomass1=RoundTo2Decimals(biomass);
}
//}
if(!rs15.next())
{
JOptionPane.showMessageDialog(this,"Match not found");
}
Aucun commentaire:
Enregistrer un commentaire