mssql ʱ¼ä¶Ô±ÈÎÊÌâ ͬ±íͬ×ֶΠÊý¾ÝµÄʱ¼ä¶Ô±È
Çó ͬ±íͬ×ֶΠÊý¾ÝµÄʱ¼ä¶Ô±È Óï¾ä
È磺
ID DATE_TIME
1 2010Äê3ÔÂ31ÈÕ 15:14:46
2 2010Äê3ÔÂ31ÈÕ 15:20:54
3 2010Äê3ÔÂ31ÈÕ 15:23:01
4 2010Äê3ÔÂ31ÈÕ 15:25:06
5 2010Äê3ÔÂ31ÈÕ 15:45:11
ÅжÏÉÏÒ»ÌõºÍÏÂÒ»ÌõµÄʱ¼ä²î
Õâ¸ö¸ñʽ...
SQL code:
--------------------------------------------------------------------------
-- Author : htl258(Tony)
-- Date : 2010-03-31 15:27:35
-- Version:Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (Intel X86)
-- Mar 29 2009 10:27:29
-- Copyright (c) 1988-2008 Microsoft Corporation
-- Developer Edition on Windows NT 5.1 <X86> (Build 2600: Service Pack 2)
--------------------------------------------------------------------------
--> Éú³É²âÊÔÊý¾Ý±í:tb
IF NOT OBJECT_ID('[tb]') IS NULL
DROP TABLE [tb]
GO
CREATE TABLE [tb]([ID] INT,[DATE_TIME] DATETIME)
INSERT [tb]
SELECT 1,N'2010-3-31 15:14:46' UNION ALL
SELECT 2,N'2010-3-31 15:20:54' UNION ALL
SELECT 3,N'2010-3-31 15:23:01' UNION ALL
SELECT 6,N'2010-3-31 15:25:06' UNION ALL
SELECT 8,N'2010-3-31 15:45:11'
GO
--SELECT * from [tb]
-->SQL²éѯÈçÏÂ:
;with t as
(
select rn=ROW_NUMBER()over(order by id),*
from tb
)
select a.DATE_TIME a,isnull(b.DATE_TIME,a.DATE_TIME) b,
DATEDIFF(mi,a.DATE_TIME,isnull(b.DATE_TIME,a.DATE_TIM
Ïà¹ØÎÊ´ð£º
Ö÷»ú
¿Í»§»úc1,c2,c3,c4,c5............
ÒªÇóÈçºÎ±£Ö¤¿Í»§»úÏòÖ÷»úÌá½»Êý¾Ý¾¡Á¿ÊµÊ±.¿ìËÙ.ÍêÕû
Ö±½ÓÓÃinsert ʱ,ËøסÖ÷»úµÄ±í.ËùÒÔ´Ë·½·¨²»¿ÉÐÐ
Çë¸ßÊÖÖ§ÕÐ..
Èç¹ûÖ»²åÈë¶ø²»¶Á£¬Óõ͸ôÀ뼶±ð
Äã²åÄãµÄ,Ëû²å ......
ÓÐÒ»¸öÊý¾Ý¿âÀïÖ»ÓÐ2WÌõÊý¾Ý²»µ½£¬È´ÓÐ500MÄÇô´ó,Ôõô»ØÊ°¡£¿ÊÇACCESSµÄÊý¾Ý¿â¡£ºóÀ´ÎÒ°ÑACCESSµ¼Èëµ½MSSQLÖУ¬Ò²Õ¼ÓÃÁË500M×óÓҵĿռ䣬Èç¹ûѹËõÊý¾Ý¿âÄØ£¿Çë¸ßÊÖÖ¸µã
ѹËõÊý¾Ý¿â£¿ÄÜ×öµ½Ã´...
ÆÚ´ý¸ßÈËÖ¸µã ÎÒ ......
×î½üÏÂÃ淴Ӧ˵³ÌÐòÒì³£
È»ºó´ò¿ªÊý¾Ý¿âÒ»¿´
·¢Ïֺܶà±í¶¼"Ö»¶Á"״̬??
ÓÃsaµÇ½ҲÊÇ...
ºÜÆæ¹Ö°¡..
´óÅ£ÖªµÀÊÇʲôÔÒòÂð?
Ô¸Òâ³ö¸ß·ÖÇó
˽â¾öÁË
¸ø200·Ö!!
Êý¾Ý¿â³öÎÊÌâÁË?
ÒýÓÃ
×î½üÏÂÃæ ......
ÈçÌ⣬MYSQLÓÖÔõô»ñÈ¡£¿
ÈçÌâ
Õâ¸ö¹À¼ÆÔÚÈÕÖ¾ÎļþÖвÅÄÜ¿´¼û°É
Õâ¸ö¹À¼ÆÔÚÈÕÖ¾ÎļþÖвÅÄÜ¿´¼û°É
ÒýÓÃ
³ý·ÇÄãÒµÎñÉÏ×ö¼Ç¼£¬·ñÔòÄãÊDz»ÄÜÖªµÀµÄ¡£ÒòΪÈÕÖ¾²»¼Ç¼selectÓï¾äÃüÁî¡£
..
ÄÇÓÐûÓÐϵͳ´ ......
db2ºÍMSSQLµÄÇø±ð(ÓÈÆäÊÇSQLÓï¾ä·½ÃæµÄÓï·¨£¬»¹ÇëÏêϸµãлл)
»°ÌâÌ«´ó£¬½¨ÒéÏÈÔÚÍøÉÏ×Ô¼ºËÑË÷һϡ£ Äã¿ÉÒÔÌù³ö¾ßÌåµÄijһµãÈôó¼ÒÀ´ÌÖÂÛ¡£
liuzhimsn (liuzhimsn)
'½ØÖÁ2010-03-31 15:46:29 Óû§½áÌ ......