SQL²éѯÎÊÌâ - MS-SQL Server / »ù´¡Àà
Óбít,±íb,ÆäÖÐtÓÐid,title,content,±íbÓÐid,tid,title,content.ÆäÖÐtµÄidÓëbµÄtidÊǹØÁªµÄ. ÏÖÔÚÎÒÏëɾbÖÐcontentΪ¿ÕµÄb¼Ç¼ºÍtÖÐÏàÓ¦µÄ¼Ç¼? ¸ÃÔõôд? ÓÐÒ»Ìì
ÄãÕâ¸öÒâ˼ÊÇÓô¥·¢Æ÷? ɾbÖÐcontentΪ¿ÕµÄb¼Ç¼ºÍtÖÐÏàÓ¦µÄ¼Ç¼ ͬʱɾ³ýÂð? SQL code: delete b where content is null go delete t where not exists(select 1 from b where tid=t.id) go SQL code: delete b where content is null delete t from t inner join b on t.id=b.tid where b.content is null ÒýÓà ɾbÖÐcontentΪ¿ÕµÄb¼Ç¼ºÍtÖÐÏàÓ¦µÄ¼Ç¼ ͬʱɾ³ýÂð? ÊǵÄ..ÒªÁ½¸ö±íÖеÄÄÇЩÊý¾Ýͬʱɾ³ý! ͬʱɾ³ýÒª´¥·¢Æ÷°Ñ£¡ ÎÒÊÔÊÔ3Â¥ºÍ4Â¥µÄ·½·¨£¡ SQL code: delete t from t inner join b on t.id=b.tid where b.content is null delete b where content is null ÊÔһϠSQL code: delete t ,b from b left join t on b.id = t.id where b.content is null Ê×ÏȵÄÎÊÌâÊÇtidÊÇÖ÷¼ü»¹ÊÇT±íÖÐIDÊÇÖ÷¼ü£¿ Èç¹ûҪɾ³ý
Ïà¹ØÎÊ´ð£º
Ö´ÐеÄ˳Ðò£º 1£©Îļþä¯ÀÀ¿ò£¨Ñ¡ÔñÎļþʹÓã© Ñ¡ÔñºÃÎļþºó µã»÷Ò»¸öµ¼Èë°´Å¥µÄʱºò £¬°ÑÉÏÃæÉÏ´«¿òÀïµÄcsvÎļþÒÔÒ»¸öIDΪÎļþÃû£¬ÉÏ´«µ½**/**Îļþ¼ÐÏ 2£©¶ÁÈ¡Õâ¸öÎļþ¼ÐϵÄcsvµÄÎļþ£¬×ª»»³Ésql 3 ......
ÎÒÓжà¸ö±í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 ......
¿ÉÄÜÒòΪ¹¤×÷µÄÔÒò ½Ó´¥Êý¾Ý¿âÕâ¿é±È½ÏÉÙ£¬Ö®Ç°¶¼ÊÇ×ö³ÌÐòÕâ¿é£¬Êý¾Ý¿âÕâ¿é¶¼ÓÐרÃŵÄÈËÀ´×ö ·Ö¹¤¶¼ºÜÃ÷ϸ ËùÒÔ¶ÔÊý¾Ý¿âÕâÒ»¿éÍêÈ«²»Á˽⡣ǰ¶Îʱ¼ä È¥ÃæÊÔÁ˼¸¼Ò¹«Ë¾ ¼¸ºõ¶¼ÊÇÔÚÊý¾Ý¿âÕâ¿é¹ÒµôµÄ Á¬¸ö¼òµ¥µÄSQ ......
µÚÒ»¾ä: select ht.gfdm,gfdm.gfmc,gfdm.lb ,sum(jh.htdj*jh.htsl)as je from ht left join gfdm on ht.gfdm=gfdm.gfdm join jh on ht.htbh=jh.hth and ht.htbh not like'del%' and ht. ......