Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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)";


Ïà¹ØÎĵµ£º

SQL×¢Èë¹¥»÷

 SQL×¢Èë¹¥»÷ÊǺڿͶÔÊý¾Ý¿â½øÐй¥»÷µÄ³£ÓÃÊÖ¶ÎÖ®Ò»¡£Ëæ×ÅB/SģʽӦÓÿª·¢µÄ·¢Õ¹£¬Ê¹ÓÃÕâÖÖģʽ±àдӦÓóÌÐòµÄ³ÌÐòÔ±Ò²Ô½À´Ô½¶à¡£µ«ÊÇÓÉÓÚ³ÌÐòÔ±µÄˮƽ¼°¾­ÑéÒ²²Î²î²»Æë£¬Ï൱´óÒ»²¿·Ö³ÌÐòÔ±ÔÚ±àд´úÂëµÄʱºò£¬Ã»ÓжÔÓû§ÊäÈëÊý¾ÝµÄºÏ·¨ÐÔ½øÐÐÅжϣ¬Ê¹Ó¦ÓóÌÐò´æÔÚ°²È«Òþ»¼¡£Óû§¿ÉÒÔÌá½»Ò»¶ÎÊý¾Ý¿â²éѯ´úÂ룬¸ù¾Ý³ÌÐò ......

Sql 2005Æô¶¯²»ÁË£¬±¨´íÈçÏÂʱµÄ½â¾ö°ì·¨£¡

½â¾ö°ì·¨£º
¿ªÊ¼->programs->MicroSoft SQL Server 2005->Configuration tools->SQL Server Configuration Manager
Ñ¡Ôñ SQL Server 2005 Network Configuartion-> Protocols for SQL ExpRESS ÔÙ Ñ¡Ôñ TCP/IP ÊôÐÔ  ,Ñ¡ÔñIP Addresses
IP1 µÄ IP Address ÇëÈ·ÈÏÊÇ Äã·þÎñÆ÷µÄ IPµØÖ· £¬  Èç¹û· ......

DelphiÁ¬½ÓSQL Server 2000

Ò»¡¢ÔÚDelphi7ÖÐÁ¬½ÓMS SQL Server 2000µÄ·½·¨¡£
¸Õ¿ªÊ¼Ê±½çÃæÈçÏ£ºÌí¼Ó4¸ö¿Ø¼þ¡£
ÉèÖÿؼþÊôÐÔ¹ý³Ì£º
1¡¢ADOConnection1ÉèÖÃ
1£©Ë«»÷ADOConnection1£¬½øÐÐÉèÖÃÁ¬½Ó×Ö·û´®£¨×÷ÓÃÊÇ£ºÑ¡È¡Á¬½ÓÇý¶¯·½Ê½ºÍÁ¬½ÓµÄÊý¾Ý¿âÉèÖã©¡£¹ý³ÌÈçÏÂͼËùʾ£º
2¡¢ADOQuery1ÉèÖ㺠
1£©ADOQuery1.connectionÊôÐÔΪADOConnection1; ......

SQL SERVER ²é¿´CPUÀûÓÃÂÊ

 --²é¿´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 Substring

 SQL ÖÐµÄ substring º¯ÊýÊÇÓÃÀ´×¥³öÒ»¸öÀ¸Î»×ÊÁÏÖÐµÄÆäÖÐÒ»²¿·Ö¡£Õâ¸öº¯ÊýµÄÃû³ÆÔÚ²»Í¬µÄ×ÊÁÏ¿âÖв»ÍêȫһÑù£º
MySQL: SUBSTR(), SUBSTRING()
Oracle: SUBSTR()
SQL Server: SUBSTRING()
×î³£Óõ½µÄ·½Ê½ÈçÏ (ÔÚÕâÀïÎÒÃÇÓÃSUBSTR()ΪÀý)£º
SUBSTR(str,pos): ÓÉ<str>ÖУ¬Ñ¡³öËùÓдӵÚ<pos>λÖÿªÊ¼ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ