![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
SQL
zb3032000
这个作者很懒,什么都没留下…
展开
-
取一个表中每个类别取十个数据
select shop_name,typeid from (SELECT dy_shopinfo.*,dense_rank() over(PARTITION BY typeid ORDER BY shopid DESC) v FROM dy_shopinfo) where v<=102009-03-12 13:51:19 · 353 阅读 · 0 评论 -
oracle 树型的寻父或寻子
寻子 SELECT * FROM shop_syscategory s CONNECT BY PRIOR id= parentid START WITH s.id = 11 寻父 SELECT * FROM shop_syscategory s CONNECT BY id= PRIOR parentid START WITH s.id =...2009-03-20 16:31:15 · 87 阅读 · 0 评论 -
ORACLE 获取系统时间
SELECT sysdate FROM DUAL;2009-03-30 21:42:24 · 80 阅读 · 0 评论 -
oracle 查询不重复记录
说明:从A表查询FORMID不为重复的记录(FORMID不为空),且符合条件1。ID为primarykey。 select * from A where ID in (select max(ID) from A where 条件1=1 GROUP BY FORMID) order by ID desc...原创 2009-05-19 09:07:36 · 591 阅读 · 0 评论 -
递归查询,用于查询一个分类下的所有分类商品
select * from shop_goods g where g.syscategoryid in ( SELECT s.id FROM shop_syscategory s CONNECT BY PRIOR id= parentid START WITH s.id = 11 ) select * from enation_user u where u.areaid...原创 2008-12-08 22:04:55 · 1480 阅读 · 1 评论 -
一个存储过程
CREATE PROCEDURE Sshytree (@current varchar(30)) as SET NOCOUNT ON DECLARE @level int, @line varchar(30) CREATE TABLE #stack (item varchar(30), level int) INSERT INTO #stack VALUES (@current, 1) CR...2008-12-08 22:06:53 · 74 阅读 · 0 评论 -
基本的SQL语句
插入 insert into 表名(1,2,3) values(1,2,3) 更新 update 表名 set 1=1,2=2,3=3 删除 delete from 表名 where 条件 查询 select 名称 from 表名 where 表名 in(select 表名 from 表名) where....... A表获得全数据B表关联 selec...2008-12-08 22:14:25 · 80 阅读 · 0 评论 -
从10G导出数据到9I
1、打开PLSQL 2、用sys登陆10G 3、执行 CREATE OR REPLACE VIEW exu9tne ( tsno, fileno, blockno, length) AS SELECT ts#, segfile#, segblock#, length FROM sys.uet$ WHERE ext# = 1 UNION ALL SELECT * FROM SYS.EXU9TNEB...2008-12-08 22:21:35 · 86 阅读 · 0 评论 -
oracle选择从n到第m条数据
select * from (select a.*,rownum rn from 数据源 a where rownum<=m) where rn>=n2009-08-27 16:13:14 · 144 阅读 · 0 评论