日期:2014-05-16 浏览次数:20515 次
?
String sql = "select a.node_name,p.name,p.path_id,a.id,a.alarm_level,a.alarm_status,a.description,a.alarm_start from path p " + "left join alarm a on a.path_id = p.path_id" + wheresql; //首先是主表, 表结构 String historysql = " union " + "select h"+i+".node_fullname as node_name,p"+i+".name,p"+i+".path_id,h"+i+".id,h"+i+".alarm_level,h"+i+".alarm_status,h"+i+".description,h"+i+".alarm_start from path p"+i + " left join historyalarm_"+i+" h"+i+" on h"+i+".path_id = p"+i+".path_id" + " where p"+i+".path_id in ("+ pathArray +")" ; 然后字段一定要对齐了,要有条件查询,必须表明缩写不跟主表一样?