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

×ö¾ØÕó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

          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 ......

ÔÚWindows XP ϰ²×°SQL SERVER2005Ïêϸ²½Öè¹ý³Ìͼ½â

°²×°Ç°×¼±¸£º
ǰÑÔ£º
¡¡¡¡[ѧϰSQL SERVER 2005ϵÁÐ]×¼±¸°Ñѧϰ2005µÄһЩÐĵÃÕûÀí³öÀ´£¬ºÍ´ó¼Ò·ÖÏí£¬¹²Í¬Ñ§Ï°Ò»ÆðÌá¸ß¡£
°²×°×¼±¸£º
1¡¢SQL Server 2005 µÄ¸÷°æ±¾Ö®¼äÑ¡Ôñ
¡¡¡¡´ó¶àÊýÆóÒµ¶¼ÔÚÈý¸ö SQL Server °æ±¾Ö®¼äÑ¡Ôñ£ºSQL Server 2005 Enterprise Edition¡¢SQL Server 2005 Standard Edition ºÍ SQL Server 2 ......

ÓÃmysqlÔ´Âë½øÐÐSQL½âÎö

http://blog.csdn.net/iamstillzhang/archive/2007/04/01/1548377.aspx
ÓÃmysqlÔ´Âë½øÐÐSQL½âÎö
MysqlÊÇͨ¹ýyacc½øÐÐSQLÓï¾ä½âÎöµÄ£¬ÕâÀï½éÉÜÒ»ÏÂÈçºÎʹÓÃmysqlµÄÔ´Âë½øÐÐSQLÓï¾ä½âÎö¡£ÓÉÓÚMysqlµÄÔ´´úÂë×¢ÊͱȽÏÉÙ£¬¶øÇÒȱÉÙ×ÊÁÏ£¬ËùÓÐЩµØ·½Ñо¿²»¹»ÉîÈë¡£
1        Filed½éÉÜ
MY ......

×ÔÔö×ֶεÄSQLÓï¾ä½â¾ö·½°¸

2009Äê06ÔÂ24ÈÕ 09:47
create table [±íÃû]
(
[×Ô¶¯±àºÅ×Ö¶Î] int IDENTITY (1,1) PRIMARY KEY ,
[×Ö¶Î1] nVarChar(50) default 'ĬÈÏÖµ' null ,
[×Ö¶Î2] ntext null ,
[×Ö¶Î3] datetime,
[×Ö¶Î4] money null ,
[×Ö¶Î5] int default 0,
[×Ö¶Î6] Decimal (12,4) default 0,
[×Ö¶Î7] image null ,
)
É ......

sql ±íÐÞ¸ÄÁÐ

 create table #a
(
a int identity(1,1) primary key,
b int default(0) not null,
c nvarchar(20)
)
insert into #a(c)
select 'a' union all
select 'b' union all
select 'c' union all
select 'd' union all
select 'e'
select * from #a
alter table #a drop constraint DF__#a_____________b__12 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ