sqlÈý±íÁªºÏ²éѯ,count´ÎÊý
sqlÈý±íÁªºÏ²éѯ
a±í£º³Ùµ½¼Ç¼±í---------------------------------------------------------------------------------------------------------------------
ÐÕÃû Ö°¹¤±àºÅ ³Ùµ½ÈÕÆÚ¼Ç¼
ÕÅÈý 001 2009-6-1
Àî˹ 002 2009-6-2
ÕÅÈý 001 2009-6-2
ÍõÎå 003 2009-6-4
ÕÅÈý 001 2009-6-15
Àî˹ 002
Ïà¹ØÎĵµ£º
³õ´ÎʹÓÃpb10µÄÅóÓÑÎÞ·¨Ë³ÀûÁ¬½Óµ½sql server£¬Ò»·½ÃæÃ»ÓÐÁËmssql serverרÓýӿÚÁË£¬ÁíÒ»·½ÃæÊý¾Ý¿â¹ÜÀíϵͳ(DBMS)»»³ÉÁË“OLE DB”£¬ÅäÖÃÆðÀ´Óе㲻˳ÊÖ£¡ÏÂÃæ¾ÍÀ´½éÉÜpb10ÖÐÓÃOLE DBÁ¬½Ósql 2000Êý¾Ý¿â¡£
ÔÚ°²×°pb10µÄʱºòÑ¡Ôñcustom/full·½Ê½°²×°£¨Ä¬Èϵݲװ·½Ê½²»»á°²×°ole db½Ó¿Ú£©£¬next£¡·Èç¹ûÄãûÓа ......
×÷Õߣº°½Ê¿Î°
Ò»ÕÅÓÐgroup byºó¿ÉÄܺܶàÖØ¸´ÐУ¬ÕâʱÓÃnot inµÈ»ùÓÚΨһÁеķֲ¼Ëã·¨»á´æÔÚÎÊÌâ¡£
ÎҵĽâ¾ö°ì·¨ÊÇ£º
Ò»ÕűíÓÐÒ»¸öid intµÄÖ÷¼ü£¬¶ÔÆäËüÁнøÐÐgroup by£¬·Öҳ˼ÏëÊÇ£º°Ñmax(id)×ögroup byºóµÄΨһÁУ¬»¹ÊÇÓÃnot inµÄ·Ö²¼Ë¼Ïë¡£
Àý£º
select top 4 sum(int_TZ2_id) as id,dt_TZ2_date,vchar_TZ2_Pin ......
дÁËÒ»¶ÎÀý×Ó£¬Í¨¹ýsql´´½¨Ò»¸öjob£¬¶¨ÆÚÖ´ÐÐһЩÇå³ý¹¤×÷¡£ÔÚsql2005ÉϲâÊÔͨ¹ý¡£
sql°ïÖúÎĵµÌ«ÁãÉ¢ÁË¡£ÕâÊÇÒ»¸öÍêÕûµÄÁ÷³Ì¡£²»¹ý×¢ÒⶨʱִÐÐʱÐèÒªsql server agent·þÎñÆ÷Æô¶¯µÄ¡£
USE msdb ;
GO
EXEC dbo.sp_add_job
@job_name = N'Clear oldest HB',
@enabled = 1,
@description = N'Clear heart ......
ÔÚÏÖ´úµÄ¶àÓû§¶àÈÎÎñϵͳÖУ¬±ØÈ»»á³öÏÖ¶à¸öÓû§Í¬Ê±·ÃÎʹ²ÏíµÄij¸ö¶ÔÏó£¬Õâ¸ö¶ÔÏó¿ÉÄÜÊÇ±í£¬ÐУ¬»òÕßÄÚ´æ½á¹¹£¬ÎªÁ˽â¾ö¶à¸öÓû§²¢·¢ÐÔ·ÃÎÊ´øÀ´µÄÊý¾ÝµÄ°²È«ÐÔ£¬ÍêÕûÐÔ¼°Ò»ÖÂÐÔÎÊÌ⣬±ØÐëÒªÓÐÒ»ÖÖ»úÖÆ£¬À´Ê¹¶ÔÕâЩ¹²Ïí×ÊÔ´µÄ²¢·¢ÐÔ·ÃÎÊ´®Ðл¯£¬oracleÖеÄËø¾Í¿ÉÒÔÌṩÕâÑùµÄ¹¦ÄÜ£¬µ±ÊÂÎñÔÚ¶Ôij¸ö¶ÔÏó½øÐвÙ×÷ǰ£¬ÏÈÏòϵͳ ......
ƽʱºÜÉÙÓÃSQL Server 2008£¬Å¼¶ûÓÃÒ»´Î£¬»¹ÕæÊÇÓöµ½ÁËһЩÎÊÌ⣬¼¸¾ÖÜÕÛ£¬´Ó¹ÙÍøÉϲÅÕÒµ½½â¾ö°ì·¨£º
ÎÊÌâÃèÊö£ºµÇ½ºó£¬µã»÷Êý¾Ý¿â£¬³öÏÖ·þÎñÆ÷Ö÷Ìå "xxxcom" ÎÞ·¨ÔÚµ±Ç°°²È«ÉÏÏÂÎÄÏ·ÃÎÊÊý¾Ý¿â "db_xxx_com"¡£
ÎÊÌâÔÒò£ºSQL Server 2008 bug
ÎÊÌâ½â¾ö°ì·¨£¨·ÇÔ´´£¬²Î¿¼¹ÙÍø£©£º
1¡¢ÓÃSQL Server Management Studi ......