SQLÓï¾äÎÊÌâ - MS-SQL Server / ÒÉÄÑÎÊÌâ
Çë½Ì¸ßÊÖ£º
ÒÔÏÂÊÇÊý¾Ý¿âÖеÄÈýÌõ¼Ç¼£¬Ó¢ÎÄΪ×Ö¶ÎÃû³Æ
id planname TaskBeginTime Status
329 2010Äê03Ô·ݼ¼ÊõÖÐÐļƻ®½¨ÒéÊé 2010-3-30 15:43:55 5 329 2010Äê03Ô·ݼ¼ÊõÖÐÐļƻ®½¨ÒéÊé 2010-3-30 16:21:17 5 329 2010Äê03Ô·ݼ¼ÊõÖÐÐļƻ®½¨ÒéÊé 2010-4-3 15:47:17 2
332 2010Äê03Ô·Ýbb¼Æ»®½¨ÒéÊé 2010-3-31 8:44:39 5 332 2010Äê03Ô·Ýbb¼Æ»®½¨ÒéÊé 2010-3-31 10:03:02 2
332 2010Äê03Ô·Ýbb¼Æ»®½¨ÒéÊé 2010-3-31 8:50:02 5
ÏÖÔÚÎÒÏëµÃµ½Ã¿Ò»¸ö¼Æ»®ÖÐTaskBeginTime×î´óµÄ¼Ç¼,ÓÃÒÔÏÂSQLÓï¾ä
SELECT PlanName, MAX(TaskBeginTime) AS Expr1
from planapprstatus
GROUP BY PlanName
Äܹ»µÃµ½329 2010Äê03Ô·ݼ¼ÊõÖÐÐļƻ®½¨ÒéÊé 2010-4-3 15:47:17 2
332 2010Äê03Ô·Ýbb¼Æ»®½¨ÒéÊé 2010-3-31 10:03:02 2
ÕâÁ½Ìõ¼Ç¼£¬
µ«Êǵ±ÎÒÓÃÒÔÏÂÓï¾äʱ(¼ÓÈëStatus)
SELECT PlanName, MAX(TaskBeginTime) AS Expr1,Satus
from planapprstatus
GROUP BY PlanName,Status
È´µÃµ½4Ìõ¼Ç¼
329 2010Äê03Ô·ݼ¼ÊõÖÐÐļƻ®½¨ÒéÊé 2010-3-30 16:21:17 5 329 2010Äê03Ô·ݼ¼ÊõÖÐÐļƻ®½¨ÒéÊé 2010-4-3 15:47:17 2
332 2010Äê03Ô·Ýbb¼Æ»®½¨ÒéÊé 2010-3-31 10:03:02 2
332 2010Äê03Ô·Ýbb¼Æ»®½¨ÒéÊé 2010-3-31 8:50:02 5
Çë¸ßÊÖÖ¸µã£¬Õâ¸öSQLÓï¾äÓÐʲôÎÊÌâ
²»Í¬µÄPlanName,Status¾Í·ÖΪһ×é
so.......
SQL code
{{-
Ïà¹ØÎÊ´ð£º
ÎÒÓжà¸ö±íA B C ½á¹¹ÊÇÒ»ÑùµÄ£¬¶¼ÓÐ2¸ö×Ö¶ÎnameºÍcontent,ÎÒÒªËÑË÷ËùÒÔ±íËùÓÐ×Ö¶ÎÖаüº¬¡°Öйú¡±µÄÄÚÈÝ Õâ¸öSQLÓï¾äÔõôд
ÈçºÎ½«¶à¸ö±íµÄ²éѯ½á¹ûÁ¬³ÉÒ»¸ö±í Õâ¸öSQLÓï¾äÔõôд ±íµÄ½á¹¹ÊÇÒ»ÑùµÄ
ÀýÈç£ ......
sqlserver2005 ½¨Á¢µÄÊý¾Ý¿â£¬ÓëÊÖ³Öpda´«ÊäÊý¾Ý£¬×î½üͻȻ³öÏÖÎÞ·¨´«µÝÊý¾ÝµÄÎÊÌ⣬pda¶ËÌáʾµÄ´íÎóʱoutofmemoryexception£¬µ«ÊÇpdaÉÏÃæµÄÈÝÁ¿Ã»ÓÐÎÊÌ⣬
sqlserverµÄÈÕ×ÓÉϵĴíÎóÈçÏ£º
ÈÕÆÚ 2010-1-25 14:45: ......
¸Õ¸Õ½Ó´¥MySQL,²»ÖªµÀ¸ÃÈçºÎÈ¥²é¿´Êý¾Ý£¬²åÈëÊý¾Ý£¬´´½¨Êý¾Ý¿â¡¢±í£¬ÓÃÄÄΪǰ±²ÄÜÖ¸½ÌÒ»¶þ£¿
MySQL 5.1²Î¿¼ÊÖ²á
ÒýÓÃ
ÐÖµÜÄã»á½áÌùÂð£¿
mysql ²Î¿¼ÊÖ²á
baidu
MySQL¹Ù·½Îĵµ http://dev.mysql.com/doc ......
µÚÒ»¾ä:
select ht.gfdm,gfdm.gfmc,gfdm.lb ,sum(jh.htdj*jh.htsl)as je
from ht left join gfdm on ht.gfdm=gfdm.gfdm
join jh on ht.htbh=jh.hth
and ht.htbh not like'del%' and ht. ......
ÇëÎÊ
Ìí¼ÓÐÂÊý¾ÝÔ´->Êý¾Ý¿â->Ìí¼ÓÁ¬½Ó
Õâ¸ö½çÃæÏ£¬Êý¾ÝÔ´Ñ¡Ôñ£ºMicrosoft SQL Server (SqlClient)£»
·þÎñÆ÷Ãû£º
Ó¦¸ÃдʲôÄØ£¿
ÓÐËÖªµÀ£¿¶àл¸÷λ£¡£¡
Äãµ½µ×ÊÇÒªÁ¬mysql»¹ÊÇmssql£¿
ÒýÓÃ
ÇëÎÊ
......