sql
kingapex1
这个作者很懒,什么都没留下…
展开
-
查询每分类前10条记录
[code="sql"]Select * From rm_article As A Where (Select Count(0) From rm_article Where cid=A.cid And aid >= A.aid group by cid)2008-06-22 13:04:39 · 463 阅读 · 0 评论 -
mysql 存储过程,执行动态sql语句
DROP PROCEDURE IF EXISTS sp_name;create procedure sp_name()begindeclare _userid,_id,no_rs int;declare sitelist CURSOR for select userid,id from eop_site ;DECLARE CONTINUE HANDLER F...原创 2010-09-12 17:07:27 · 523 阅读 · 0 评论 -
mysql 5.0存储过程学习总结(转)
一.创建存储过程1.基本语法:create procedure sp_name()begin………end2.参数传递二.调用存储过程1.基本语法:call sp_name()注意:存储过程名称后面必须加括号,哪怕该存储过程没有参数传递三.删除存储过程1.基本语法:drop procedure sp_name//2.注意事项(1...原创 2010-09-12 13:35:13 · 134 阅读 · 0 评论 -
查询父子关系结构列表和子个数
select c.*,count(s.cat_id) from js_goods_cat as c left join js_goods_cat as s on s.parent_id = c.cat_id group by c.cat_id order by parent_id,cat_order2008-12-26 10:44:38 · 1209 阅读 · 1 评论 -
oracle 10G 导入 9i 空记录解决办法
导出前接行 CREATE OR REPLACE VIEW exu9tne (tsno, fileno, blockno, length) ASSELECT ts#, segfile#, segblock#, lengthFROM sys.uet$WHERE ext# = 1UNION ALLSELECT * FROM SYS.EXU9TNEB2008-12-01 17:07:11 · 87 阅读 · 0 评论 -
字段操作sql语句
/*添加字段*/alter table DY_COOPERATE add AREA_STR varchar2(255); /*删除字段*/alter table DY_COOPERATE drop column AREA_STR; /*修改字段名*/alter table DY_COOPERATE rename column AREA_STR to AREA_STR1; /*...2008-11-28 09:29:48 · 117 阅读 · 0 评论 -
oracle 树型的寻父或寻子
寻子: SELECT * FROM shop_syscategory sCONNECT BY PRIOR id= parentid START WITH s.id = 11 寻父:SELECT * FROM shop_syscategory sCONNECT BY id= PRIOR parentid START WITH s.id = 500090...2008-08-27 14:20:49 · 122 阅读 · 0 评论 -
oracle 树型
select * from (Select distinct name,categoryId,parentid,sort_order From shop_category START WITH parentid IS NULL Connect by parentid = prior categoryId order by sort_order) Start with pare...2008-06-02 18:06:32 · 97 阅读 · 0 评论 -
oracle 更新时间型字段
update tb set updateTime=to_date('2008-09-10 12:11:11','yyyy-MM-dd HH24:mi:ss')2008-06-27 11:01:28 · 1631 阅读 · 0 评论 -
mysql alter 语句用法,添加、修改、删除字段等(转)
//主键549830479 alter table tabelname add new_field_id int(5) unsigned default 0 not null auto_increment ,add primary key (new_field_id);//增加一个新列549830479 alter table t2 add d timestamp;...原创 2010-09-13 10:06:50 · 156 阅读 · 0 评论