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

ÊÕ¼¯µÄÓÖÒ»µÀÓÐȤµÄSQLÌâ

×÷Õß: ÈýÊ®¶øÁ¢Ê±¼ä£º2009Äê10ÔÂ15ÈÕ 21:59:51±¾Îijö×Ô ¡°inthirties£¨ÈýÊ®¶øÁ¢£©¡±²©¿Í£¬×ªÔØÇëÎñ±Ø×¢Ã÷×÷Õߺͱ£Áô³ö´¦http://blog.csdn.net/inthirties/archive/2009/10/15/4673268.aspx °Ñ´ÎÐò²»¶ÔµÄÁÐÕÒ³öÀ´ ÇëÎÊ ÏÂÃæµÄ±í¸ÃÈçºÎÅÅÐò£¿ÎÒÓÐÏÂÃæµÄ±í¡£´ÎÐòÈçÏ ÆäÖеÚ5¸ö¼Ç¼ºÍµÚ6Ìõ¼Ç¼´ÎÐòµßµ¹ÁË¡£Õâ¸ö±íÊý¾ÝÁ¿±È½Ï´ó¡£ ÓÃʲô·½·¨¿ÉÒÔ¶ÔÕâ¸ö±íÖÐµÄ bÁÐÅÅÐò¡£Ê¹ÆäÄܹ»°´ÕÕÉýÐòÅÅÁС£ 
a b 
1 #1¸ËËþ 
2 #2¸ËËþ 
3 #3.1¸ËËþ 
4 #3.2¸ËËþ 
5 #5¸ËËþ 
6 #4¸ËËþ 
7 #6¸ËËþ 
8 #7¸ËËþ 
9 #9¸ËËþ 
10 #8¸ËËþ 

ÏÖÔÚÒª×öµÄÊÂÇé¾ÍÊÇ°Ñ ´ÎÐò²»¶ÔµÄÁÐÕÒ³öÀ´¡£ ²»ÊÇÅÅÐò¡£±ÈÈçÉÏÁÐÖÐbÁеÚ5£¬µÚ6ÁС£µÚ9£¬10´ÎÐò²»¶Ô¡£ ÏÖÔÚÒª°ÑÆäÖеÄÁÐÕÒ³öÀ´¡£ 
5 #5¸ËËþ 
6 #4¸ËËþ 
9 #9¸ËËþ 
10 #8¸ËËþ 
¾ÍÊÇ°ÑÕâÑùµÄÁÐÄܹ»ÕÒ³öÀ´¡£ SQL> with temp as( 
2 select 1 a, '#1¸ËËþ' b from dual union all 
3 select 2 a, '#2¸ËËþ' b from dual union all 
4 select 3 a, '#3.1¸ËËþ' b from dual union all 
5 select 4 a, '#3.2¸ËËþ' b from dual union all 
6 select 5 a, '#5¸ËËþ' b from dual union all 
7 select 6 a, '#4¸ËËþ' b from dual 
8 ) select a, b from (select temp.*, row_number() over(order by a asc) a_ord,r 
ow_number() over(order by to_number(substr(b, 2, length(b)-3)) asc) b_ord from t 
emp) t where t.a_ord <>t.b_ord; 

A B 
---------- -------- 
6 #4¸ËËþ 
5 #5¸ËËþ


Èç¹ûûÓÐÄǾ䡰ÈýÊ®¶øÁ¢¡±£¬ÈýÊ®ËêµÄÄÐÈËÕý¿ÉÒÔÇáÇáËÉËÉ ×¨ÒµÂÛ̳ http://www.inthirties.com ¼¼Êõ²©¿Í http://blog.csdn.net/inthirties ¸öÈËÕ¾µã http://blog.inthirties.com Oracle Mysql¼¼ÊõÂÛ̳| ´òÔìʵÓõÄOracle Mysql¼¼Êõ½»Á÷Ô°µØ


Ïà¹ØÎĵµ£º

JSPʵÀýÈý¡¢sql·ÖÒ³(1)

index.jsp
<%@ page language="java" import="java.sql.*" import="java.lang.*" import="java.util.*" pageEncoding="GB2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%!
& ......

SQL SERVER ÓëACCESS¡¢EXCELµÄÊý¾Ýת»»

ÊìϤSQL SERVER 2000µÄÊý¾Ý¿â¹ÜÀíÔ±¶¼ÖªµÀ£¬ÆäDTS¿ÉÒÔ½øÐÐÊý¾ÝµÄµ¼Èëµ¼³ö£¬Æäʵ£¬ÎÒÃÇÒ²¿ÉÒÔʹÓÃTransact-SQLÓï¾ä½øÐе¼Èëµ¼³ö²Ù×÷¡£ÔÚTransact-SQLÓï¾äÖУ¬ÎÒÃÇÖ÷ҪʹÓÃOpenDataSourceº¯Êý¡¢OPENROWSET º¯Êý£¬¹ØÓÚº¯ÊýµÄÏêϸ˵Ã÷£¬Çë²Î¿¼SQLÁª»ú°ïÖú¡£ÀûÓÃÏÂÊö·½·¨£¬¿ÉÒÔÊ®·ÖÈÝÒ×µØʵÏÖSQL SERVER¡¢ACCESS¡¢EXCELÊý¾Ýת»»£ ......

SQLSERVER SQLÐÔÄÜÓÅ»¯

1.Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)¡¡¡¡
¡¡¡¡ SQLSERVERµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬Òò´Ëfrom×Ó¾äÖÐдÔÚ×îºóµÄ±í£¨»ù´¡±ídriving table£©½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏ£¬±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í£¬µ±SQLSERVER´¦Àí¶à¸ö±íʱ£¬»áÔËÓÃÅÅÐò¼°ºÏ²¢µÄ·½Ê½Á ......

Oracle SQL NULL Öµ¶Ô IN/NOT INÓï¾äµÄÓ°Ïì

  ½ñÌ죬ÓÐÒ»¸ösql NOT INÓï¾ä£¬Æ¥ÅäÌõ¼þÀïÓÐÒ»¸önull£¬½á¹ûʲô¶¼²é²»³öÀ´£¬Í¬Ê¾õµÃºÜÄÑÀí½â¡£ÆäʵֻҪÃ÷°×Ò»µã¾Í¿ÉÒÔÁË£¬INÓï¾äÆ¥ÅäµÄʱºòÊÇÓÃ=£¬NOT INÆ¥ÅäµÄʱ»áÓÃ<>£¬¾ÍºÜÈÝÒ×Àí½âÁË¡£
Ê×ÏÈÎÒÃÇÒªÖªµÀ£¬nullÔÚoracleÊǸöÌØÊâµÄ¶«Î÷£¬Ã»ÓÐÈκοɱÈÐÔ£¬Èç¹ûʹÓà =/<> ¶Ô±Ènull£¬µÃµ½µÄʼÖÕÊÇfalse¡£n ......

SQLÓï¾äÓÅ»¯·½·¨

1.Ö»²éѯÐèÒªµÄÁУ¬²»ÓÃ*
2.INÊʺÏÓÚÍâ±í´ó¶øÄÚ±íСµÄÇé¿ö£»EXISTSÊʺÏÓÚÍâ±íС¶øÄÚ±í´óµÄÇé¿ö 1¡¢Éý¼¶Ó²¼þ
2¡¢¸ù¾Ý²éѯÌõ¼þ,½¨Á¢Ë÷Òý,ÓÅ»¯Ë÷Òý¡¢ÓÅ»¯·ÃÎÊ·½Ê½£¬ÏÞÖƽá¹û¼¯µÄÊý¾ÝÁ¿¡£
3¡¢À©´ó·þÎñÆ÷µÄÄÚ´æ
4¡¢Ôö¼Ó·þÎñÆ÷CPU¸öÊý
5¡¢¶ÔÓÚ´óµÄÊý¾Ý¿â²»ÒªÉèÖÃÊý¾Ý¿â×Ô¶¯Ôö³¤£¬Ëü»á½µµÍ·þÎñÆ÷µÄÐÔÄÜ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ