SQLȡֵÎÊÌâ - MS-SQL Server / »ù´¡Àà
±ítable
A B
12*2+10*5
4*3+10*4
15*2+81*4
ÈçºÎÈ¡BÁÐÖеÚÒ»¸ö*ºÅǰµÄÊý£¬²¢¸³¸øAÁÐ
--search
SQL code:
select left(b,charindex('*',b)-1) from table where left(b,charindex('*',b)-1)
--update
SQL code:
update table
set a = left(b,charindex('*',b)-1) from table where left(b,charindex('*',b)-1)
select left(b,charindex('*',b)-1) from table where left(b,charindex('*',b)-1) > 0
update table set a = left(b,charindex('*',b)-1) from table where left(b,charindex('*',b)-1) > 0
SQL code:
update ±ítable set A=left(B,charindex('*',B)-1)
¶¼ÊÇÅ£È˰¡¡£
û¶àÉÙ·Ö£¬ºÇºÇ£¬È¨µ±Òâ˼Ï¡£ÐÂÊÖ¡£¡£²»ºÃÒâ˼¡£
Ïà¹ØÎÊ´ð£º
ÏÖÔÚÓÐÁ½ÕÅ±í£ºÎÄÕÂÖ÷±íA(articleId,articleTitle)£¬ÎÄÕÂÆÀÂÛ±íB(commentId,articleId,commentTitle)
ÏÖÔÚÎÒÏëʵÏÖÕâÑùµÄ¹¦ÄÜ£ºÁгöÎÄÕÂÁÐ±í£¬ÆäÖÐÿƪÎÄÕ±êÌâÏÂÃæÁгö´ËÎÄÕµÄǰ2¸öÎÄÕÂÆÀÂÛ£¬ÇëÎÊsqlÓï¾äÔõôд°¡ ......
×Ö¶Î1,×Ö¶Î2.....×Ö¶ÎN,Status,ParentID
1,Name1....test1,1,99
1,Name1....test1,3,99
1,Name2....test2,1,101
1,Name2....test2,3,101
1,Name3....test3,2,101
1,Name1....test1,4,101
ÏëÒªµÄ½á¹ûÊÇ:
1,Na ......
ÐèÇóÈçÏ£º
ѧԺ academy£¨aid,aname£©
°à¼¶ class£¨cid,cname,aid£©
ѧÉú stu(sid,sname,aid,cid)
סËÞÇø region(rid,rname)
ËÞÉáÂ¥ build(bid,rid,bnote) bnoteÊÇ¡®ÄС¯/¡®Å®¡¯
ËÞÉá dorm(did,rid,bid£¬bedn ......
¸÷λºÃ£¬ÎÒ¸Õ°ÑÒ»¸öASPÍøÕ¾ÉèÖúÃÁË£¬Ò²ÄÜÕý³£·ÃÎÊ¡£µ«ÊÇÔÚÎÒ±¾»úÉϲ»ÄÜ´ò¿ªadmin\login.asp,ËùÒÔÎÞ·¨ÊµÏÖºǫ́¹ÜÀí¡££¨´íÎóÌáʾÎÞ·¨ÕÒµ½ÍøÒ³£¬´úÂë404£¬ÎҵIJÙ×÷ϵͳÊÇwin2000 server)
µ«ÊÇÆæ¹ÖµÄÊÇÔÚ¾ÖÓòÍøµÄÆäËû» ......