1.round(数据,2),数据保留两位小数;
decode(分母,0,1,分母) ,消除分母为的情况。
2.select table.xx ,(select * from table1) table1 from xx
3. from R_PM_TD_MR_TADVPCCPCHRSCP t,
(select r_rc.lac,r_rc.cell_id,r_rc.nodeb_name,r_rc.rncid
from R_CM_F_T_C_UTRANCELL r_rc where instr(r_rc.city_name,'兰州')>0 group by
r_rc.lac,r_rc.cell_id,r_rc.nodeb_name,r_rc.rncid) rc
where t.rncid=rc.rncid and t.cellid=rc.cell_id and
t.START_TIME between to_date('2014-04-17 00:00:00','yyyy-mm-dd hh24:mi:ss')
and to_date('2014-04-18 23:59:59','yyyy-mm-dd hh24:mi:ss') group by t.rncid,t.cellid,rc.lac,rc.cell_id,rc.nodeb_name
group.... by .... having;;where 可以随意组合,但是 group.... by .... 后面必须跟having,where 后面可以再group.... by .
4.当几个表组合查询时,子表有10来个,外表有10来个时,就可以配置XML文件,将子表何外边分开写,最后在程序中组合,这样SQL语句就只写20来条,而不是100来条。
XML特殊字符在我的博客里面。