Èç¹ûдµÝ¹ésqlÓï¾ä - MS-SQL Server / Ó¦ÓÃʵÀý
ÓÐÁ½¸öͬÑùµÄ±í½á¹¹
±í½á¹¹ÈçÏ£º
id£¨ÐòºÅ£© parentid £¨¸¸½áµãÐòºÅ£© name(½áµãÃû³Æ)
±í1 ¼Ç¼ 1 0 aaa
2 0 bbb
3 1 ccc
¡£¡£¡£¡£¡£¡£
±í2 ¼Ç¼
1 0 bbb
2 0 xxx
¡£¡£¡£¡£
±í1Óë±í2¶¼ÊÇÊ÷×´½á¹¹¼Ç¼¡£ÏÖÐèÒª½«±í1¼Ç¼µ¼Èëµ½±í2ÖÐ £¬±í2ÖÐÒѾÓв¿·Ö¼Ç¼£¬ÓÐЩ¼Ç¼Óë±í1ÖмǼÏàͬ¡£
ÏÖÐèÒª½«±í1ÖеļǼµ¼Èëµ½±í2ÖУ¬ÐèÒªÅжϱí2ÖÐûÓбí1¼Ç¼µÄÐèҪȫ²¿µ¼È룬²¢ÇÒÊ÷×´½á¹¹ºÍ±í1ÖеĽṹһÖ¡£
Óô洢¹ý³ÌÒ²¿ÉÒÔ¡£Ð»Ð»¡£
MRAK »ØÈ¥ÔÙ¿´
¶¥ÏÂ
SQL code:
insert into ±í2
select * from ±í1 a where not exists
(select 1 from ±í2 b where a.id=b.id and a.parentid=b.parentid and a.name=b.name)
¿ÉÒÔ³¢ÊÔ
Ŷ ЧÂʰ¡Ð§ÂÊ
ÔÀ´ÕâÑùÕæµÄ¿ÉÒÔ¡£¡£ÏëÁË¡£Ã»
Ïà¹ØÎÊ´ð£º
ÎÒÓжà¸ö±íA B C ½á¹¹ÊÇÒ»ÑùµÄ£¬¶¼ÓÐ2¸ö×Ö¶ÎnameºÍcontent,ÎÒÒªËÑË÷ËùÒÔ±íËùÓÐ×Ö¶ÎÖаüº¬¡°Öйú¡±µÄÄÚÈÝ Õâ¸öSQLÓï¾äÔõôд
ÈçºÎ½«¶à¸ö±íµÄ²éѯ½á¹ûÁ¬³ÉÒ»¸ö±í Õâ¸öSQLÓï¾äÔõôд ±íµÄ½á¹¹ÊÇÒ»ÑùµÄ
ÀýÈç£ ......
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
¸÷λ´óÏÀ¾ÈÃü°¡ £¡£¡
¸Õ×°ÁËSQL2000 sp3
ÏëÓÃJSPÁ¬½ÓÊý¾Ý¿âµ«ÊdzöÏÖÎÊÌâÁË
ÎÒÓõÄÊÇJDK6.0+tomcat5.0+SQL2000 SP3+JDBC sp3
ËüÏÔʾµÄÊÇ
javax.servlet.ServletException: [Microsoft][SQLServer 2000 Driver fo ......
ÎÒµÄTblworkbill±íµÄÊý¾ÝÈçÏÂ:
id workbillno ..................
1 1
2 6
3 a1
4 c2
5 2
6 aa
7 ......
ÓÐÒ»Õűí(SHGL)
JLBH LXR LXDH SHDZ
1 a ......