Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

sqlÓï¾ä»ñȡҶ×Ó½Úµã

±í½á¹¹ Ϊ
id parentid name
1    0
2    0
3    1
4    3
5    2
ÊäÈë0ÏÖÔÚÏëµÃµ½
4 5
Ò²¾ÍÊÇ»ñȡҶ×ӽڵ㣬¸ÄÔõôʵÏÖ£¿ лл

http://blog.csdn.net/wufeng4552/archive/2009/09/30/4619995.aspx

ÎÒÒªµÄÊÇÒ¶×ӽڵ㣬¾ÍÊÇ×îµ×²ãµÄ½Úµã

0 µÃµ½4,5 ?

ÒýÓÃ
http://blog.csdn.net/wufeng4552/archive/2009/09/30/4619995.aspx

Õâ¸öºÃ

BOM¡¡¾«»ª

¶Ô 0 µÃµ½ 4 5

SQL code:
-->Title:Generating test data
-->Author:wufeng4552
-->Date :2009-09-30 14:27:56

if not object_id('tb') is null
drop table tb
Go
Create table tb([id] int,[parentid] int,[name] varchar(10))
Insert tb
select 1,0,null union all
select 2,0,null union all
select 3,1,null union all
select 4,3,null union all
select 5,2,null
Go
-->Title:²éÕÒÖ¸¶¨節點ϵÄ×Ó結點
if object_id('Uf_GetChildID')is not null drop function Uf_GetChildID
go
create function Uf_GetChildID(@ParentID int)
returns @t table(ID int)
as
begin
insert @t select ID from tb where ParentID=@ParentID
while @@rowcount<>0
begin
insert @t select a.ID from tb a inner join @t b
on a.ParentID=b.id and
not exists(select 1 from @t where id=a.id)


Ïà¹ØÎÊ´ð£º

¹ØÓÚgroup byµÄsqlÓï¾ä£¿

  with adod_dict do
    begin
    close;
    commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd=:tnd group by bgqxcode'; ......

SQLÓï¾äÎÊÌ⣬¸ßÊÖ°ïæ£¡£¡

½«Ò»¸ö±í21~30ɾ³ý£¬sqlÓï¾äÔõôд
Õâ¸öÌ«ÁýͳÁË£¬ÊÇÅÅÐòºóµÄµÚ21Ìõµ½30Ìõ¼Ç¼ɾ³ý»¹ÊÇijһÁÐÖµÔÚ21µ½30Ö®¼äµÄɾ³ý°¡£¿

21-30ÊÇʲôÒâ˼£¿×ֶεϰ¾Ídelete from table1 where col1>=21 and col1<=30
Ö¸µ ......

sql ÎÊÌâ

PBÖпª·¢µÄ¡£

DateTime startTime=DateTime(em_1.Text)
DateTime endTime=DateTime(em_2.Text)

string sql
sql = dw_1.GetSQLSelect()+"Where (StartTime> '"+startTime+&q ......

Çë½Ì¸÷λ´ó¸çÒ»¸öSqlÎÊÌ⣬Äĸö°à¼¶µÄ½Ìʦ´ýÓö×î¸ß£¿

СµÜ×î½üÓöµ½Ò»¸öÎÊÌ⣬ҪÇóµÃ³öÄĸö°à¼¶µÄ½Ìʦ´ýÓö×î¸ß£¬°Ñͬһ¸ö°à¼¶µÄ½Ìʦ´ýÓöºÏ¼ÆÆðÀ´


°à¼¶±í                  ½Ìʦ±í

°à¼¶ID    & ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ