SQLÓï¾ä
BeginTime BtsId Total68PhyRCENum
2009-9-30 0:00 1 192
2009-10-1 0:00 1 192
2009-10-2 0:00 1 192
2009-10-3 0:00 1 192
2009-10-4 0:00 1 256
2009-10-5 0:00 1 256
2009-10-6 0:00 1 256
2009-10-7 0:00 1 256
2009-10-8 0:00 1 256
2009-10-9 0:00 1 256
ÈçºÎ¸ù¾ÝTotal68PhyRCENum·¢Éú±ä»»ºó£¬Ìæ»»³ö¸ÃÌõ¼Ç¼
BeginTime BtsId Total68PhyRCENum
2009-9-30 0:00 1 192
2009-10-1 0:00 1 192
2009-10-2 0:00 1 192
2009-10-3 0:00 1 192
2009-10-4 0:00 1 256
2009-10-5 0:00 1 256
2009-10-6 0:00 1 256
2009-10-7 0:00 1 256
2009-10-8 0:00 1 256
2009-10-9 0:00 1 256
ÈçºÎ¸ù¾ÝTotal68PhyRCENum·¢Éú±ä»»ºó£¬ÌáÈ¡³öºìÉ«ÕâÌõ¼Ç¼
û¿´Ã÷°×¡£
¾ßÌåÒªÇóÊÇɶ£¿
--Óαê............
-- I love curssor......
ÎÒ¶à¼Ó¸öS£¬ºÇºÇ£¬ÒòΪÎÒϲ»¶Ëü£¬..........
Óøö×ÔÔöÁÐ,
ÔÙÓÃ×Ó²éѯ
SQL code:
select *,id=identity(int,1,1) into #t from tb1
select b.* from #t a,#t b
where a.id=b.id-1 and a.Total68PhyRCENum!=b.Total68PhyRCENum
select min(BeginTime)
group by Total68PhyRCENum
2009-9-30 0:00 1 192
2009-10-1 0:00 1 192
2009-10-2 0:00 1 192
2009-10-3 0:00 1 192
2009-10-4 0:00 1 256
Ïà¹ØÎÊ´ð£º
ÏÖÔÚÓÐÁ½¸öÒì¹¹µÄsql serverÊý¾Ý¿â,ÎÒÏ뽫µÚÒ»¸ö±íÖеÄÊý¾Ýµ¼Èëµ½µÚ¶þ¸ö±íÖÐ,×Ô¼ºÖ¸¶¨µ¼ÈëÊý¾ÝµÄ×Ö¶Î,ÈçºÎµ¼ÈëÊý¾ÝÄØ,´ó¼ÒÌÖÂÛÒ»ÏÂ?
dts¹¤¾ß
µ¼Èëµ¼³ö¹¤¾ß.
DD
¹þ¹þ£¬¹À¼ÆÕâλÊǵØQIOU¶¼Êܲ»Á˵Ä
Ö±½ÓÐ ......
Êý¾ÝÀàÐÍ£º
Code char(6)
CreateTime datetime
Price float
Êý¾ÝÈçÏ£º
Code CreateTime Price
031021 2008-10-17 15:00:1 ......
ÓÐÁ½ÕÅ×Ö¶ÎÏàͬµÄ±íA£¬B¡£×Ö¶ÎΪSN, Name, Operator, Result, Remark
A±íÖÐ×Ö¶ÎSNΨһ£¬B±íÖÐ×Ö¶ÎSN²»Î¨Ò»£¬ÓкܶàÌõ
ÈçºÎÓÃÒ»ÌõselectÓï¾ä
°Ñ·ûºÏSN=¡¯abc¡¯µÄ¼Ç¼´ÓA£¬B±íÖÐɸѡ³öÀ´£¿
SQL co ......
'Select * into mytable from OpenDataSource(''Microsoft.JET.OLEDB.4.0'',''Data Source=f:\test.xls;Mode=Read;Extended Properties=Excel 5.0;Persist Security Info=False' ......
Çë°ïæ¿´¿´ÔõôÓÅ»¯Ò»Ï£¬¸Ã±íÊý¾ÝԼΪ66Íò£¬ÔËÐÐʱ¼äÒª19Ãë,SQLÈçÏ£º
select DATEPART (hh ,Date_time ) as Hours ,
sum(Counts)*100.0/(Select sum(Counts) as total
&nbs ......