Quantcast
Channel: BlogJava-leekiang-随笔分类-sql
Browsing latest articles
Browse All 2 View Live

Image may be NSFW.
Clik here to view.

获取一段时间范围内的日期列表

select  to_date( ' 2007/02/26 ' ,  ' yyyy/mm/dd ' )  +  rownum  -   1   from  user_objects  where  rownum  <=   (to_date( ' 2007/03/01' ,  ' yyyy/mm/dd ' ) - to_date( ' 2007/02/26 ' ,  ' yyyy/mm/dd...

View Article


Image may be NSFW.
Clik here to view.

父子表根据id找到所有的子孙id

     有张表,有两个字段: id,patentid,他们分别记录了这条记录的id,以及父id号,     如何根据最顶层的id找到所有的id,包括子id,孙子id,以及重孙id. --用递归查询SELECT ID, PARENTID FROM tablename Start With ID = 'xxx' Connect By Prior ID = ParentId...

View Article

Browsing latest articles
Browse All 2 View Live