连表查询

来源:互联网 发布:mac和nars口红哪个便宜 编辑:程序博客网 时间:2024/05/17 20:39
public static void RegisterMaterNum(String mainID){
String strKsql=" select p.fMaterialType as fMaterialType,  p.fTypeCode as  fTypeCode, p.fMaterName as  fMaterName, p.fMaterCode as  fMaterCode , p.fMaterSpecif as fMaterSpecif , p.fMaterUnite as  fMaterUnite, p.fTotalSum  as  fTotalSum, a.fProJect as  fProJect "
+" from MasterList p optional join MasterTable a on p.fZBID = '"+mainID+"' where  a.fProJect in(select s.fProjectName from  InventInformaTable s)";
System.out.println("strKsql");
Table t = KSQL.select(strKsql,null,"/SceneTeam/ClassDoor/data",null);
Iterator<Row> rows =t.iterator();
while(rows.hasNext()){
Row row = rows.next();
String  fMaterialType = row.getString("fMaterialType");
String  fTypeCode = row.getString("fTypeCode");
String  fMaterName = row.getString("fMaterName");
String  fMaterCode =  row.getString("fMaterCode");
String  fMaterSpecif = row.getString("fMaterSpecif");
String  fMaterUnite = row.getString("fMaterUnite");
Integer  fTotalSum = row.getInteger("fTotalSum");
String  fProJect = row.getString("fProJect");
String upStr = " insert into InventInformaTable s (s,s.fProjectName,s.fMaterName,s.fMaterCode,s.fMaterSpecif,s.fMaterUnite,s.fMaterialType,s.fTypeCode,s.fTotalSum)values("+"guid(),'"+fProJect+"','"+fMaterName+"','"+fMaterCode+"','"+fMaterSpecif+"','"+fMaterUnite+"','"+fMaterialType+"','"+fTypeCode+"','"+fTotalSum+"')";
System.out.println("upStr");
KSQL.executeUpdate(upStr,null,"/SceneTeam/ClassDoor/data",null);




}




}
0 0
原创粉丝点击