摘要: select * from(select a.*,rownum row_num from(select * from mytable t order by t.id desc) a ) b where b.row_num between 1 and 10根据rou_num字段来查询分页数据,条件在between中传参数。 阅读全文
posted @ 2010-09-15 17:02 anny0320 阅读(464) 评论(0) 推荐(0) 编辑
摘要: 主要是为了便于动态连接后续条件,即使后面的查询条件都为空都可以查询,还有就是避免后面是and而出错。where1=1有什么用?在SQL语言中,写这么一句话就跟没写一样。select*fromtable1where1=1与select*fromtable1完全没有区别,甚至还有其他许多写法,1<>2,'a'='a','a'<>'b',其目的就只有一个,where的条件为永真,... 阅读全文
posted @ 2010-09-15 16:58 anny0320 阅读(773) 评论(0) 推荐(1) 编辑