ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

Ãö©ó¸ê®Æ²Î­p»P­pºâªºSQL«ü¥O

Ãö©ó¸ê®Æ²Î­p»P­pºâªºSQL«ü¥O

³Ìªñ¦³¤@­ÓSQL²Õ¦X«ü¥O¤@ª½§xÂZµÛ¤p§Ì,¤U¹Ï¤¤,¤W¤è¬°­û¤u½Ð°²ªí
¦~²×¤F­nµ²ºâ½Ð°²¤é¼Æ¨Ã¥X²{¬ÛÃö²Î­p¸ê®Æ


¥i¯à¦³¦~¬ö¤F,¸£µ¬¥´¦ºµ²
·Q½Ð±Ð¦U¦ì,¦p­nÀò±o¤W¹Ïªº¸ê®Æ²Î­pµ²ªG,SQL«ü¥O¸Ó¦p¦ó²Õ¦X?
¬¡­¶Ã¯1.xls (34 KB)
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

¤p»x¦n
¦³§Ç¸¹¡A¤é´Á¡A­ì¦]¡C¦³³o¤LÄæ¥ÎSQLµLªk¦X¨Ö»P­pºâ

TOP

¤£ª¾¹D³o¼Ë¦æ¤£¦æ~

select max(§Ç¸¹), max(½Ð°²¤é), ©m¦W, ©Ê§O, max(¦~ÄÖ), ­ì¦], count(*)
from table_name
group by ©m¦W, ©Ê§O, ­ì¦]
­Y¬O§Ú¦^µª¡A¨Ï±zº¡·N¡A½Ð±zÅý§Úª¾¹D¡I                  
­Y¬O§Úªº¦^ÂСA±z¤´¦³¨ä¥L¨£¸Ñ¡A¤]½Ð±z¤£¶Þ«ü±Ð¡I

TOP

¦^´_ 1# ¤p»x
½Ð°Ñ¦Ò¤U¦Cºô§}ªº "Practice Exercise #3:" ½d¨Ò (¦ì¦b¤å³¹³Ì«á)¡G
The syntax for the SQL COUNT function

TOP

¥»©«³Ì«á¥Ñ diabo ©ó 2013-1-10 10:22 ½s¿è

¦^´_ 1# ¤p»x

¤£¦Ò¼{®Ä¯àªº¸Ü¡A§Q¥Î¤l¬d¸ß¥i¥H§@¨ì....
PS
1 ±N¸ê®Æ²¾¨ì¡iDB¤u§@ªí¡j
2 §Aªº´ú¸Õ¸ê®Æ¦³ÂI°ÝÃD¡A§Ç¸¹»P½Ð°²¤éÀ³¸Ó³£­n¥Ñ¤p¨ì¤j¤~¦X²z...

select tmpTable2.§Ç¸¹2,tmpTable2.½Ð°²¤é2,tmpTable2.©m¦W2, tmpTable.©Ê§O,tmpTable2.¦~ÄÖ2, tmpTable.­ì¦],tmpTable2.½Ð°²¼Æ2 from ((select max(§Ç¸¹) as §Ç¸¹2, max(½Ð°²¤é) as ½Ð°²¤é2, ©m¦W as ©m¦W2, max(¦~ÄÖ) as ¦~ÄÖ2, count(*) as ½Ð°²¼Æ2 FROM [DB$A:F] GROUP BY ©m¦W) tmpTable2),((select * From [DB$A:F]) tmpTable) Where tmpTable2.§Ç¸¹2=tmpTable.§Ç¸¹

¬¡­¶Ã¯1_rev1.rar (15.99 KB)

¬¡­¶Ã¯1_rev2.rar (15.36 KB)

1

µû¤À¤H¼Æ

    • ¤p»x: À°¤F¤j¦£Åo, §ÚªºSQL¨ä¹ê§ó½ÆÂø,¦ý´N¯Ê¤F§A ...ª÷¿ú + 5
diabo

TOP

·P®¦¦U¦ìªº¨ó§U,´ú¸Õ«á¦V¦U¦ì¦^³ø,¦A¦¸·PÁÂ!!

20130111§ó·s¦^³ø
diaboªº§@ªk¦¨¥\,«D±`·P®¦!!
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

        ÀR«ä¦Û¦b : ­ì½Ì§O¤H´N¬Oµ½«Ý¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD