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

ÇóÒ»¸üÐÂSQLÓï¾ä - MS-SQL Server / »ù´¡Àà

±í½á¹¹


FItemNumber FEntryId
001
001
001
002
003
003


ÇóÒ»SQLÓï¾ä£¬¸üÐÂFEntryIdÈçÏÂ
FItemNumber FEntryId
001 1  
001 2
001 3
002 1
003 1
003 2

³ýÁËÓαêÑ­»·£¬»¹ÓÐʲôºÃ·½·¨¡£




¶¥¡£¡£¡£¡£

SQL code:
;with t as
(
select rn=row_number()over(partition by FItemNumber order by getdate()),*
from tb
)
update t set FentryID=rn


SQL code:
--------------------------------------------------------------------------
-- Author : htl258(Tony)
-- Date : 2010-04-18 10:05:10
-- Version:Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (Intel X86)
-- Jul 9 2008 14:43:34
-- 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]([FItemNumber] NVARCHAR(10),[FEntryId] INT)
INSERT [tb]
SELECT '001',1 UNION ALL
SELECT '001',NULL UNION ALL
SELECT '001',NULL


Ïà¹ØÎÊ´ð£º

sqlÓÅ»¯ - Oracle / »ù´¡ºÍ¹ÜÀí

select count(1) from FX_RETURNBOOKCHECKLIST fxreturnbo0_ where fxreturnbo0_.BOOKID='164 ' AND fxreturnbo0_.RETURNID='00025.S0000001' 
ÉÏÃæÒ»¸ö¼òµ¥µÄSQL,Ö´ÐÐʱ¼ä2.6à ......

ÇóÒ»SQL - MS-SQL Server / »ù´¡Àà

tab1 ×Ö¶Î:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 ×Ö¶Î:goodsid,goodskind£¨ÉÌÆ·ÀàÐÍ£©
tab3 ×Ö¶Î:goodskind£¨ÉÌÆ·ÀàÐÍ£©,kindname
½á¹û£º
µÃµ½ÉÌÆ·ÀàÐÍÔÚÒ»¶Îʱ¼ä ......

ÈçºÎʹÓÃMySQL - MS-SQL Server / »ù´¡Àà

¸Õ¸Õ½Ó´¥MySQL,²»ÖªµÀ¸ÃÈçºÎÈ¥²é¿´Êý¾Ý£¬²åÈëÊý¾Ý£¬´´½¨Êý¾Ý¿â¡¢±í£¬ÓÃÄÄΪǰ±²ÄÜÖ¸½ÌÒ»¶þ£¿

MySQL 5.1²Î¿¼ÊÖ²á

ÒýÓÃ
ÐÖµÜÄã»á½áÌùÂð£¿
mysql ²Î¿¼ÊÖ²á

baidu

MySQL¹Ù·½Îĵµ http://dev.mysql.com/doc ......

Çë½ÌSQLÓï¾ä²éѯÎÊÌ⣿ - MS-SQL Server / »ù´¡Àà

ÎÒÏë²éѯ³öÿÌìÊý¾ÝµÄ×î´óµÄÒ»¸öÖµ¡£±íµÄ¸ñʽÈçÏÂ
±íÃû: hisdata
×Ö¶Î ±àºÅ Öµ ״̬ ʱ¼ä  
  Id value state dattime  
  101 32.3 0 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ