×ö¾ØÕó1£©¹ØÓÚsqlÓï¾ä
×ö¸ö¾ØÕó£¬Æäʵ¾ÍÊǸö¶þάÊý×飬¹Ø¼üÊÇÒª´ÓÊý¾Ý¿âÀïµ÷ЩÊý¾Ý£¬sqlÓï¾ä²»ÊìÁ·£¬¾Í±ßѧ±ßÓã¬Í¬²½µØ¼ÇЩ±Ê¼Ç£¬·½±ã²éÔÄ
¹ØÓÚdistinctºÍorder by ·¢Á˸öÌû×Ó£¨µÚÒ»´ÎŶ£©
Ê×Ìû£º
ÓõÄÊÇoracleµÄÊý¾Ý¿â
Ä¿µÄÊÇÏëÑ¡³öΨһµÄuserid£¨ÔÓÐÖظ´Öµ£©,²¢ÇÒ°´ÕÕfileposÅÅÐò£¨ÔfileposÊÇ1£¬2£¬3.¡£¡£²»Öظ´µÄÐòºÅ£©
ÎÊÌ⣺ÒÔÏÂÓï¾ä¶¼²»ÄÜÂú×ãÒªÇó
1£©select distinct userid from bbsfile where rootid=371841£¨²»Öظ´£¬µ«ÊÇû°´Ë³ÐòÅÅ£©
2£©select distinct userid,filepos from bbsfile where rootid=371841 order by filepos(°´Ë³ÐòÅÅÁУ¬µ«ÊÇÓÐÖظ´)
3£©select distinct userid from bbsfile where rootid=371841 order by filepos(Óï·¨³ö´í)
¾ÍÊÇÏëÈóöÏÖÖظ´ÖµµÄÒ»Áа´ÕÕûÓÐÖظ´ÖµµÃÒ»ÁÐÅÅÐò
ÓÐÒ»¸ö¼òµ¥µÄ»Ø¸´½â¾öÁËÎÊÌâ
select userid from bbsfile where rootid=371841 group by userid order by min(filepos);
˼¿¼µÄ½Ç¶È±äһϾͳö½á¹ûÁË£¬ÕâÀï¹Ø¼üÊÇÓõ½ÁËmin Õâô¼òµ¥µÄ¾ÍÈ¥µôÁËÖظ´¡£
·ÖÎö£ºdistinct Ö»ÄÜÑ¡³öºóÃæ¸úµÄÒ»´®×ÖËù¹¹³ÉµÄÐУ¬ÈÃÿһÐж¼²»Ïàͬ¡£
µ«ÊÇ£¬order by ºóÃæµÄ¶«Î÷ÓÖ±ØÐë³öÏÖÔÚdistinct ºóÃæ ¡£ËùÒÔ³öÏÖÁËÉÏÊöÎÊÌâ¡£»òÐí»¹ÓбðµÄºÃµÄ½â¾ö°ì·¨£¬ÔÝûÏëµ½¡£
¿¼ÂÇʱ¼ä£ºÓÉÓÚʱ¼ä°üÀ¨ÈÕÆÚºÍʱ¼ä£¬Èç¹û½öÊÇfiletime=xxÄêÔÂÈÕ ·µ»Ø¿Õ£¬to_charºÜºÃÓ㬿ÉÒÔ½«Ê±¼äת»»ÎªÌض¨¸ñʽ¡£
trunc(filetime)='15-10ÔÂ-07' and to_char(filetime,'hh24') between 18 and 20 group by bbsuserid order by min(filepos)";
Ïà¹ØÎĵµ£º
Comparison of SQL and MDX Syntax
The Multidimensional Expressions (MDX) syntax is similar to the syntax of Structured Query Language (SQL). In many ways, the functionality supplied by MDX is also similar to that of SQL; with effort, you can eve ......
¹ØÓÚsqlÁ¬½Ó
Á¬½ÓÀàÐÍ
ÔÚ¹Øϵ´úÊýÖУ¬Á¬½ÓÔËËãÊÇÓÉÒ»¸öµÑ¿¨¶û»ýÔËËãºÍÒ»¸öÑ¡È¡ÔËËã¹¹³ÉµÄ¡£Ê×ÏÈÓõѿ¨¶û»ýÍê³É¶ÔÁ½¸öÊý¾Ý¼¯ºÏµÄ³ËÔËË㣬Ȼºó¶ÔÉú³ÉµÄ½á¹û
¼¯ºÏ½øÐÐÑ¡È¡ÔËË㣬ȷ±£Ö»°Ñ·Ö±ðÀ´×ÔÁ½¸öÊý¾Ý¼¯ºÏ²¢ÇÒ¾ßÓÐÖصþ²¿·ÖµÄÐкϲ¢ÔÚÒ»Æð¡£Á¬½ÓµÄÈ«²¿ÒâÒåÔÚÓÚÔÚˮƽ·½ÏòÉϺϲ¢Á½¸öÊý¾Ý¼¯ºÏ£¨Í¨³£ÊÇ±í£©£¬²¢²úÉú
Ò ......
´ò¿ª²éѯ·ÖÎöÆ÷£¬ÊäÈëÃüÁî¼´¿É¡£ DUMP TRANSACTION Êý¾Ý¿âÃû WITH NO_LOG
Èç¹û¾õµÃ·¢ÏÖLDFÎļþÕ¼ÓôÅÅ̿ռ仹ÊǺܴó¡£
Çë´ò¿ªÆóÒµ¹ÜÀíÆ÷--ÓÒ¼üµã»÷ÐèѹËõµÄÊý¾Ý¿â--ËùÓÐÈÎÎñ--ÊÕËõÊý¾Ý¿â--ÊÕËõÎļþ--Ñ¡ÔñÈÕÖ¾Îļþ--ÔÚÊÕËõ·½Ê½ÀïÑ¡ÔñÊÕËõÖÁXXM,ÕâÀï»á¸ø³öÒ»¸öÔÊÐíÊÕËõµ½µÄ×îСMÊý,µ÷ÕûÈ·¶¨¼´¿É¡£
Technorati ±êÇ©: SQL ......
--²é¿´CPUÀûÓÃÂÊ
-- CREATE PROCEDURE sp_GetTop10_CPU () AS
BEGIN
SET NOCOUNT ON
DECLARE @cinterval char(8)
DECLARE @interval int
SET @cinterval = '00:00:10'
CREATE TABLE #thread
(
RUN INT NOT NULL,
SPI ......
¼¸¸öɾ³ýÖظ´¼Ç¼µÄSQLÓï¾ä
2009-03-02 10:08
±ÈÈçÏÖÔÚÓÐÒ»ÈËÔ±±í £¨±íÃû£ºpeosons£©
ÈôÏ뽫ÐÕÃû¡¢Éí·ÝÖ¤ºÅ¡¢×¡Ö·ÕâÈý¸ö×Ö¶ÎÍêÈ«ÏàͬµÄ¼Ç¼²éѯ³öÀ´
select p1.* from persons p1,persons p2 where p1.id<>p2.id &nb ......