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

[µo°Ý] ¥ÎVBA¦Û¤v¿z¿ï ÁÙ¬O¥Î¤@¯ë¤è¦¡³B²z?

[µo°Ý] ¥ÎVBA¦Û¤v¿z¿ï ÁÙ¬O¥Î¤@¯ë¤è¦¡³B²z?

·Q½Ð°Ý¤@¤U¤j®a
¦³¿ìªk±N ªþ¥[Àɮפ¤ ¨C¤é¥Í²£¤u®É/²£­È ¨ºÃ䪺¤º®e
¥t¥~°µ¤@­ÓSHEETS ¹³ [¨C¤é³øªí] ¨º¼Ë
¦pªG¦b[¨C¤é³øªí]¿é¤J¤é´Á µM«á ¾Þ§@­ûªº  ¶}©l®É¶¡ µ²§ô®É¶¡ Á`¤u®É ¥ð®§®É¶¡  ¤u®É®t ²£­È
¯à¦Û¤v¶]¥X¨Ó¥[Á`¶Ü

§Ú¦³¸Õ¹L¥Î¼Ï¯Ã¤ÀªRªí ¤£¹L¸ê®Æ¸ò¦Û¤v¥[Á`ªº¤£¤Ó¹ï?
­n¥Îµ{¦¡¤U¥h¶]¶Ü
³Â·Ð¤j®a¤F

³øªí.rar (45.22 KB)

¥»©«³Ì«á¥Ñ joey0415 ©ó 2013-11-11 12:03 ½s¿è

§Ú¦Û¤v·s¶}¤@­Ó·sÀÉ

¸ê®Æ=>²{¦³³s½u=>§ó¦h=>excelÀÉ=>¤é³øªí=>¤º®e=>©w¸q

Àx¦s®æ­×§ï¤@¤U®æ¦¡³]©w

°Ñ¦Ò°Ñ¦Ò

sql»yªk

select ¤é´Á,¾Þ§@­û,¶}©l®É¶¡,µ²§ô®É¶¡,[Á`¤u®É(¤À)],[¥ð®§®É¶¡(¤À)],[À³§¹¦¨®É¶¡(¤À)],¤u®É®t from [¤é³øªí$] where ¾Þ§@­û='¸¦©g'

select sum([Á`¤u®É(¤À)]),sum([¥ð®§®É¶¡(¤À)]),sum([À³§¹¦¨®É¶¡(¤À)]),sum(¤u®É®t) from [¤é³øªí$] where ¾Þ§@­û='¸¦©g'









TOP

¦^´_ 2# joey0415
·Q½Ð°Ý¤@¤U
¥i¬O³o¼Ëªº°µªk ¯à¬Ý¨ì¨C­Ó¾Þ§@­ûªº¸ê®Æ¶Ü
¤£¦n·N«ä §Ú¹ï©óSQL¤£¬O«Ü¤F¸Ñ ¥i¥H°Ý¤@¤U»yªk¬O­n©ñ¦b­þ¸Ì§r?

TOP

¦^´_ 2# joey0415

§A¦n
§Ú¸Õ¹L§A»¡ªº³o­Ó¤èªk¤F
¤£¹L¦b¦X­pªº¦a¤è
ÁÙ¬O­n¦Û¤v¥[Á`¹ï¤£¹ï?

TOP

¥»©«³Ì«á¥Ñ joey0415 ©ó 2013-11-11 19:08 ½s¿è

¦^´_ 4# guaga

select sum([Á`¤u®É(¤À)]),sum([¥ð®§®É¶¡(¤À)]),sum([À³§¹¦¨®É¶¡(¤À)]),sum(¤u®É®t) from [¤é³øªí$] where ¾Þ§@­û='¸¦©g'

³Ì«á¤@±i¹Ï´N¬O¸¦©gªº­Ó¤H¥[Á`¡A¦pªG­n¨C¤H¡A¨C¤Ñªº¥[Á`

§A¥i¯àÁÙ­n¦A°Ñ¦Ò¤@¤Usql¤¤ªºgroup by»yªk¡A¥\¯à«Ü±j¤j®@¡I

§Ú¦Û¤w¦b¸ê®Æ®w¤¤¨Ï¥Îgroup by»yªk¡A¬ù29¸Uµ§¸ê®Æ¡A¥Hexcel¥s¥X¨Ó¡A¨Ã¨Ï¥ÎÂù­«group by»yªk¡A¦n¹³¤£¥Î¤Q¬í´N¹Bºâ§¹¤F

§A¨º­ÓÁٺⲳæ¡A«Øij¦pªG¸ê®Æ¶q¤j¤@¨Ç¡AÁÙ¬O©ñ¦b¯u¥¿ªº¸ê®Æ®w¤¤¡A¦w¥þ¹Bºâ¤S¤è«K

·íµM¥H¤W»yªk¡A¦pªG¥¿½T¡A§AÁÙ¥i¥H¥Î¿ý»sªº¤è¦¡¡A²£¤@vba½X¡A³Ì«á§â¤H¦Wµ¥§ï¦¨Åܼƨûs¦¨¤U©Ô¿ï³æ«ö¶s¡A³Ì«á§A­n¬d¤°»ò¡A¤U©Ô¿ï³æ§ä¨ì¤H¦W¡A«ö¤U¥h´Nª¾¹D

ªá¤@ÂI®É¶¡¬ã¨s¤@¤U´N¥i¥H¬Ù«Ü¦h¤O®ð

³ÕºÓ¤å¤Æªº  excel»P¥~³¡¸ê®ÆµLÁ_¾ã¦X¡A³o¥»§A¥i¥H°Ñ¦Ò¤@¤U¡I

°Ñ¦Ò

TOP

¦^´_ 5# joey0415

§Ú¥Î¥X¨Ó¤FÁÂÁ§A
·Q½Ð°Ý¤@¤U §A»¡ªºgroup by  
¦³¿ìªk±N©Ò¦³¾Þ§@­û°µ¤@­Ó¥[Á`¶Ü
ÁÙ¬O­n¥ÎVBA¼¶¼g?

TOP

¥»©«³Ì«á¥Ñ joey0415 ©ó 2013-11-12 11:43 ½s¿è

¦^´_ 6# guaga

select   ­û¤u, sum(§A­n¥[Á`ªºÄæ¦ì¡A¨Ò¦p¤u®É) from §Aªºsheet   where §A­n¿ï¨úªº½d³ò(¦p«ü©w¤é´Á¡K)    group by §A­n¨C¤À²ÕªºÄæ¦ì(¨Ò¦p¡G­û¤u, ¤é´Á)


    Ãþ¦ü³o¼Ëªº»yªk¡A§A¤j·§¥i¥H§â©Ò¦³ªº¸ê®Æ¡A«ö·Ó¡A­û¤u»P¤é´Á¡A§â©Ò¦³¤u®É¥[Á`


¥H¤W¬°­Ó¤H¦Û¾Ç¥Î»y¤£¤@©wºë·Ç

group by´N¬O§â§A­nªº¸ê®Æ¤À¦¨¤@¸s¤@¸sªº¡A¤§«e¦b«ö·Ó§A­nselect±ø¥ó§PÂ_¡A¨Ò¦p§A­nsum¥[Á`¡A¥¦´N±N§A«ü©wªº¸s²Õ¥[Á`¡K


°Ñ¦Ò°Ñ¦Ò

TOP

¦^´_ 7# joey0415
¦Û¾Ç¥i¥H³o»ò¼F®`  §Ú­nÀË°QÀË°Q
¬O°Ñ¦Ò"excel»P¥~³¡¸ê®ÆµLÁ_¾ã¦X"³o¥»¾Çªº¶Ü

TOP

¦^´_ 8# guaga

¤£¦n·N«ä ¦b½Ð°Ý¤@¤U ¦pªG­n¼W¥[¾Þ§@¤H­û¬O ¦bwhere ¾Þ§@­û«á­±¦A¼W¥[¦WºÙ¶Ü
select sum([Á`¤u®É(¤À)]),sum([¥ð®§®É¶¡(¤À)]),sum([À³§¹¦¨®É¶¡(¤À)]),sum(¤u®É®t) from [¨RÀ£¤é³øªí$] where ¾Þ§@­û='¸¦©g,¦t©Ô'

TOP

¦^´_ 9# guaga


select sum([Á`¤u®É(¤À)]),sum([¥ð®§®É¶¡(¤À)]),sum([À³§¹¦¨®É¶¡(¤À)]),sum(¤u®É®t) from [¨RÀ£¤é³øªí$] where ¾Þ§@­û in ('¸¦©g','¦t©Ô')

¥i¥H°Ñ¦Ò¥H¤U
http://www.1keydata.com/tw/sql/sqlin.html

¦Ó²Ä¤E½g¦^¤åªº¤è¦¡¡A¥i¥H¦C¥X©Ò¦³¾Þ§@­ûªº¥[Á`¶µ

¦Ó§A°Ýªº«h¬O«ü©w¬Y¨Ç¤H­û

¦Ó in  ¤¤ªº¤H­û¡A¤]¥i¥H¬Oselcet¬d¸ß  ¡A¨Ò¦p§A§Q§ä¨ì¬YºØ±Æ¦Cªº«e¤T¦W»yªk«á¡A§â¥¦©ñ¶iin¤¤¡A¥¦¤]·|¦Û°Ê§ä¥X§A­nªº¶i¶¥¸ê®Æ

¨Ò¦p¤l¬d¸ß
http://www.1keydata.com/tw/sql/sql-subquery.html
°Ñ¦Ò

TOP

        ÀR«ä¦Û¦b : ¤@¥y·Å·xªº¸Ü¡A´N¹³©¹§O¤H¨­¤WÅx­»¤ô¡A¦Û¤v·|ªg¨ì¨â¤Tºw¡C
ªð¦^¦Cªí ¤W¤@¥DÃD