|
楼主 |
发表于 2017-5-12 17:13:06
|
显示全部楼层
public static Table demo(){
String oracle = "SELECT RCOMPANYNAME , RCATEGORYNAME ,SUM(CB) AS RCB FROM( SELECT (SELECT RCATEGORYNAME FROM DEMO_REPORTPRODUCTCATEGORY WHERE DEMO_REPORTPRODUCTCATEGORY.RCATEGORYID = DEMO_REPORTPRODUCTS.RCATEGORYID) AS RCATEGORYNAME , (SELECT RCOMPANYNAME FROM DEMO_REPORTSUPPLIERS WHERE DEMO_REPORTSUPPLIERS.RSUPPLIERID = DEMO_REPORTPRODUCTS.RSUPPLIERID)AS RCOMPANYNAME, RUNITPRICE*RUNITSINSTOCK AS CB FROM DEMO_REPORTPRODUCTS WHERE DEMO_REPORTPRODUCTS.RSUPPLIERID IN ('1','2','3','4'))A GROUP BY A.RCOMPANYNAME ,A.RCATEGORYNAME";
String mssql = "SELECT RCOMPANYNAME , RCATEGORYNAME ,SUM(CB) AS RCB FROM( SELECT (SELECT RCATEGORYNAME FROM DEMO_REPORTPRODUCTCATEGORY WHERE DEMO_REPORTPRODUCTCATEGORY.RCATEGORYID = DEMO_REPORTPRODUCTS.RCATEGORYID) AS RCATEGORYNAME , (SELECT RCOMPANYNAME FROM DEMO_REPORTSUPPLIERS WHERE DEMO_REPORTSUPPLIERS.RSUPPLIERID = DEMO_REPORTPRODUCTS.RSUPPLIERID)AS RCOMPANYNAME, RUNITPRICE*RUNITSINSTOCK AS CB FROM DEMO_REPORTPRODUCTS WHERE DEMO_REPORTPRODUCTS.RSUPPLIERID = '1' OR DEMO_REPORTPRODUCTS.RSUPPLIERID = '2' OR DEMO_REPORTPRODUCTS.RSUPPLIERID = '3' OR DEMO_REPORTPRODUCTS.RSUPPLIERID = '4')A GROUP BY A.RCOMPANYNAME ,A.RCATEGORYNAME";
HashMap<String,String> sqlMap = new HashMap<String,String>();
sqlMap.put(SQL.DEFAULT_DB_NAME,mssql);
sqlMap.put(DatabaseProduct.ORACLE.name(),oracle);
sqlMap.put(DatabaseProduct.MSSQL.name(),mssql);
sqlMap.put(DatabaseProduct.KINGBASE.name(),oracle);
sqlMap.put(DatabaseProduct.SYBASE.name(),mssql);
sqlMap.put(DatabaseProduct.DB2.name(),oracle);
return SQL.select(sqlMap,null,"/x5demo/demo/data");
}
您能帮我详细解释一下红色字体的代码吗??
|
|