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

ÇóÒ»SQLÓï¾ä

ÓÐA±íÓëB±íÈçÏ£º
A±í
ID BH FLAG
1 a01
2 a02
3 a03

B±í
BH LOCK
a01 1
a01 0
a02 1
a02 1
a03 0
a03 0

¸ù¾ÝB±í£¬¸üÐÂA±íFLAGÊôÐÔ,ÆÚÍû½á¹û£º
ID BH FLAG
1 a01 2
2 a02 1
3 a03 0

a01 µÄ2 ÊÇÔõôÀ´µÄ£¿

ÒýÓÃ
a01 µÄ2 ÊÇÔõôÀ´µÄ£¿

ͬÎÊ

SQL code:
---------------------------------------------
--> Author : js_szy
--> Target : ¸÷λ´ó´ó,С×ä¾ÍÊÇÏëÒªÒ»¶ä»¨
--> Date : 2009-12-02 09:52:22
--> Version: SQL Server 2005
---------------------------------------------

--> ²âÊÔÊý¾Ý: @a
declare @a table (ID int,BH varchar(3),FLAG sql_variant)
insert into @a
select 1,'a01',null union all
select 2,'a02',null union all
select 3,'a03',null

--> ²âÊÔÊý¾Ý: @b
declare @b table (BH varchar(3),LOCK int)
insert into @b
select 'a01',1 union all
select 'a01',0 union all
select 'a02',1 union all
select 'a02',1 union all
select 'a03',0 union all
select 'a03',0

update @a
set flag=b.lock
from @a a,
(select bh,lock=sum(lock) from @b group by bh)b
where a.bh=b.bh

select * from @a

ID BH FLAG
-----------


Ïà¹ØÎÊ´ð£º

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

±íÈçÏÂ
½ÌÊÒID ×ùλÊý ¿ªÊ¼Ê±¼ä ½áÊøÊ±¼ä 2009Äê1ÔÂ1ÈÕ 2009Äê1ÔÂ2ÈÕ 2009Äê1ÔÂ3ÈÕ
  101 50 08£º00 08£º30 30 40 50  
  101 50 09£º00 ......

sqlת»»ÎÊÌ⣬¼±£¡ - ÉçÇøÖ§³Ö / ¡¶³ÌÐòÔ±¡·ÔÓÖ¾

select convert(varchar(50),cast(convert(numeric(18,2),1275674000000/100000000)as real))+'ÒÚ'
select cast(convert(numeric(18,2),1275674000000/100000000)as real)
ΪʲôÉÏÒ»¸öÓÃvarcharת»»ºó¾ÍÖ»±£ÁôÁËÒ ......

jspÁ´½Ósql2000µÄÒÉÎÊ£¿



type Exception report


message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jas ......

sql º¯ÊýÎÊÌâ - MS-SQL Server / Ó¦ÓÃʵÀý

sqlÎÒÏëµÃµ½Ò»×Ö·û´®Îª:
sldkf|||sdeww
erkv|||rltdk
jemcl|||ligf
¾ÍÊÇ|||ºóÃæµÄ×Ö·ûÓÐʲôº¯ÊýÄܵõ½Âð£¿ÊÇÔÚsqlÓï¾äдµÄ£¬²»ÊÇÔÚÒ³ÃæÐ´µÄ£¬ÄÇλ¸ßÊÖÀ´Ö¸½ÌÏ£¬ÐÂÊÖ£¬Ð»Ð»
ÔνñÌì²»ÊÇдÁËô

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