数据库
坐看花开
这个作者很懒,什么都没留下…
展开
-
sql语句 按小时统计
select count(distinct id) cnt , substr(time,1,13) hours from mytable a group by substr(time,1,13) order by 2原创 2012-06-29 16:23:19 · 2171 阅读 · 0 评论 -
手动解析SQL语句
解析原始sql 如:将 转成 ? 及 clmn的值public static String getSQLPrepare(String paramSql, Map toValue) { if (paramSql == null || paramSql.length() < 1) { return ""; } List tempList = new ArrayList();原创 2014-01-09 11:42:34 · 706 阅读 · 0 评论 -
JDBCTemplate 分页查询
jt.query(sql, args, new ResultSetExtractor(){ @Override public Object extractData(ResultSet rs) throws SQLException, DataAccessException { int currentRow = 0; int columnCount = rs.getMet原创 2014-01-09 11:44:05 · 1551 阅读 · 0 评论 -
Oracle字符串截取
oracle截取字符串将C3411.907w15 截取点号之前的字符串C3411 SUBSTR ('C3411.907w15', 0, INSTR ('C3411.907w15, '.', 1, 1) - 1)SELECT SUBSTR ('C3411.907w15', 0, INSTR ('C3411.907w15, '.', 1, 1) - 1) FRO原创 2012-08-23 14:43:11 · 540 阅读 · 0 评论 -
Orcale SQL语句实现查询分组后每组的最大值
SELECT TAB_A.* FROM ( SELECT a.*, ROW_NUMBER() OVER( PARTITION BY a.分组字段 ORDER BY a.排序字段 DESC ) ROWNO FROM 表1 a ) TAB_A WHERE ROWNO = 1原创 2012-07-04 12:26:01 · 570 阅读 · 0 评论