ÇóÖúÒ»¾äSQLÓï¾ä
Êý¾ÝÀàÐÍ£º
Code char(6)
CreateTime datetime
Price float
Êý¾ÝÈçÏ£º
Code CreateTime Price
031002 2008-10-17 15:00:15 3.58
031012 2008-10-17 15:00:16 5.53
031022 2008-10-17 15:00:17 4.54
031032 2008-10-17 15:00:18 3.51
031013 2008-10-17 15:00:19 3.52
031023 2008-10-17 15:00:20 2.50
031033 2008-10-17 15:00:21 4.53
031054 2008-10-17 15:00:22 3.55
031004 2008-10-17 15:00:23 3.55
031024 2008-10-17 15:00:24 5.57
ÎÒ²éѯ
SELECT * from Table Where Price between 4 and 5
³öÀ´µÄ½á¹ûÊÇ
031022 2008-10-17 15:00:17 4.54
031033 2008-10-17 15:00:21 4.53
ÎÒÏëÒªµÄ½á¹ûÊÇ
031032 2008-10-17 15:00:18 3.51
031054 2008-10-17 15:00:22 3.55
¾ÍÊÇ˵Ҫ·ûºÏ²éѯµÄÌõ¼þµÄÏÂÒ»Ìõ£¬Ëû±¾ÌõÌø¹ý£¬ÇëÎÊÕâ¾äSQLÒªÔõôд£¬Ð»Ð»£¡
SQL code:
SELECT *,(select count(1) from [table] where Code<=T.code) as id into #temp from [Table] t Where Price between 4 and 5
select * from #temp t where
exists (SELECT 1 from #temp Where Price betw
Ïà¹ØÎÊ´ð£º
µã»÷¡°·þÎñ¹ÜÀíÆ÷¡±£¬µã»÷¡°¿ªÊ¼/¼ÌÐø¡±£¬×ÜÊÇÏÔʾ¡°ÓÉÓڵǼʧ°Ü¶øÆô¶¯·þÎñ¡±£¬È»ºóÔٴγö´í£¬²»Äܹ»½øÈ룬Ҳ²»Äܹ»²é¿´ÊôÐÔ£¬ÇëÎÊ´ó¼Ò¸ÃÔõô°ì£¿
ÎÒÊDzſªÊ¼Ñ§Ï°Êý¾Ý¿â£¬ÇëÎÊ´ó¼ÒÓÐûÓÐʲôºÃһЩµÄ½¨Òé»òÕ ......
²éѯ½á¹û¼¯£º
ps online totle
a 0 10
b 1 11
c 5 8
ÏëÏÔʾ³ÉÕâÑù ......
±ÈÈç ÓÐÒ»×Ö¶ÎΪ£º
Num
6111
6201
6520
65121
60087
46300
ÎÒÏë°Ñ6¿ªÍ·µÄÈ«¶¼Ìæ»»³É5¿ªÍ·
×¢ÒâÕâÊDZíÀïµÄÊý¾Ý£¬ÎÒÏëÓÃSQLÓï¾äʵÏÖÌæ»»
SQL code:
update tb set
num = s ......
A»úÆ÷£¨XP£©£¨10.10.6.65£©ÍêÕûµÄ¼ÆËã»úÃûÊÇ: DZD·þÎñÆ÷
ÎÒ×°ÁËÒ»¸ö¸öÈ˰棺 SQLServer2000,´´½¨ÁËÒ»¸öʵÀýÃûΪ£ºMYINSTANCE
×°ÁË£ºdotNetFx35setup.exe
²¢´òºÃÁËSP4²¹¶¡£ºSQL2000-KB884525-SP ......