9-1 »{ÃÑDML«ü¥O(9-1-1 Select«ü¥O)
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1190
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-25
|
9-1 »{ÃÑDML«ü¥O(9-1-1 Select«ü¥O)
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1190
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-25
|
·í§Ú̱N³o¡u¶i¶¥¬d¸ß«ü¥O¡vÀ³¥Î©óµ{¦¡¤¤±N¥i±o¨ì¹Ï9-3ªºµ²ªG¡A³Q±ø¦C¥X¨Óªºû¤u³£¬O¥ð°²¤Ñ¼Æ¶W¹L¤T¤ÑªÌ¡C
ex09_01.php- <?
- $conn = mysql_connect("localhost", "root", "12345a");
- if(@mysql_select_db("LEAVE", $conn))
- {
- //«ü©w´£¨ú¸ê®Æªº®Õ¹ï¦r¤¸ªí
- mysql_query("set character set big5");
- //¸ê®Æ®w¦s¦b,«Ø¥ßSQL©R¥O¦r¦ê
- $SQL="Select * From Factoryman where ©m¦W In" .
- "(Select ©m¦W From laik Where ¤Ñ¼Æ>3)"; //±N¦^¶Çµ²ªG¦s©ñ©óÅܼƤ¤
- $datalist=mysql_query($SQL);
- //¨ú±oÄæ¦ì¼Æ¶q
- $fieldnum=mysql_num_fields($datalist);
- ?>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=big5">
- <title>½d¨Òex09_01</title>
- </head>
- <center><table border=1 width=100%>
- <?
- /**************¦C¥XÄæ¦ì©ïÀY***************/
- echo "<tr>";
- for ($x=0 ;$x<$fieldnum;$x++)
- {
- echo "<td>" . mysql_field_name($datalist,$x) . "</td>";
- }
- echo "</tr>";
- /**************¦C¥XÄæ¦ì¸ê®Æ***************/
- //±N¸ê®Æ¿ýÂà´«¬°Äæ¦ì°}¦C¶°¦X
- while ($fielddatas=mysql_fetch_array($datalist))
- {
- //¿é¥XÄæ¦ì¸ê®Æ
- echo "<tr>";
- for ($x=0;$x<$fieldnum;$x++)
- {
- echo "<td>" . $fielddatas[$x] . "</td>";
- }
- echo "</tr>";
- }
- ?>
- <table></body>
- </html>
- <?
- }
- else
- {
- echo "¸ê®Æ®w¤£¦s¦b";
- }
- ?>
½Æ»s¥N½X
¹Ï9-3 ½d¨Òex09_01.php¡C |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1190
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-25
|
¤À²Õ¿z¿ï
Group By«ü¥O¤F¥i¥H¥Î¨Ó±Æ§Ç¥~¡A¤]¥i¥H¦P®É¥[¤W±Æ§Ç«ü¥O¨Ó¶i¦æ¸ê®Æ±Æ§Ç¡A¨Ò¦p¡G§ÚÌ¥H¡u°²§O¡v¬°¤À²Õ¨Ì¾Ú¡A§Q¥ÎOrder By«ü¥O°w¹ï¥ð°²¤Ñ¼Æ¨Ó±Æ§Ç¡G- Select °²§O,Sum(¤Ñ¼Æ) AS ¥ð°²Á`¤Ñ¼Æ From laik Group By°²§O Order By¥ð°²Á`¤Ñ¼Æ
½Æ»s¥N½X °£¤F±Æ§Ç¤§¥~¡A§ÚÌÁÙ¥i¥[¤WWhere«ü¥O¥ý¶i¦æ¸ê®Æ¿z¿ï«á¦A¶i¦æ¤À²Õ»P±Æ§Ç¡G- Select °²§O,Sum(¤Ñ¼Æ) AS ¥ð°²Á`¤Ñ¼Æ From laik Where
- ¦~=86 Group By°²§O Order By¥ð°²Á`¤Ñ¼Æ
½Æ»s¥N½X ¤W¨â¦¡ªº±Ôz°õ¦æµ²ªG¦p¹Ï9-8¡An¯S§Oª`·N¨ì¤@ÂI¡G¨Ï¥ÎWhere«ü¥O¶i¦æ¿z¿ï¡A¥u¯à°÷¦bì©l¸ê®Æªº±¡ªp¤U¶i¦æ¿z¿ïªº°Ê§@¡A¤]´N¬O»¡¡A¿z¿ï¸ê®Æªº°Ê§@¥²¶·µo¥Í©ó¤À²Õ°Ê§@¤§«e¡A¤£¯à¦b¤À²Õ°Ê§@§¹¦¨¤§«á¤~¨Ï¥ÎWhere«ü¥O¶i¦æ¤À²Õµ²ªGªº¿z¿ï¡I
¹Ï9-8 ¹Ï¥ª¬°¤À²Õ»P±Æ§Ç¡F¹Ï¥k¬°¸ê®Æ¿z¿ï«á¦A¶i¦æ¤À²Õ»P±Æ§Ç¡C |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1190
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-25
|
¨º§Ú¥i¤£¥i¥H§ó§ï¿z¿ïªº±ø¥óÈ¡H¥i¥H¡A±z¤£¦ý¥i¥H¨Ï¥Î¡uµêÀÀ¡vÄæ¦ì¬°¿z¿ïªº®Ú¾Ú¡A¦p¤U¨Ò¡G- Select ¦~,©m¦W,°²§O,sum(¤Ñ¼Æ) AS ¦~¥ð°²¼Æ From ¥ð°²°O¿ý
- Group By ¦~,©m¦W,°²§O Having ¦~¥ð°²¼Æ>2
½Æ»s¥N½X ¤W¦¡¤¤ªº¡u¦~¥ð°²¼Æ¡vÁöµM¬O¡uSum(¤Ñ¼Æ)¡vªºpºâµ²ªG¡A¥¦¤]¬O¤@Ó¡uµêÀÀ¡vÄæ¦ì¡A¤£¬O¸ê®Æ®w¤¤ªº¯u¹êÄæ¦ì¡A¦ý¬O«o¯à¥Î¨Ó°µ¬°¿z¿ïªº®Ú¾Ú¡C
¦pªG±zn¨Ï¥Î¡upºâ¡vÄæ¦ì°µ¬°¿z¿ï®Ú¾Ú¡A¤]¥i¥H¼¶¼g¦¨¤U¦¡¡G¡]½d¨Òex09_05.php¡^- SQL="Select ¦~,©m¦W,°²§O,sum(¤Ñ¼Æ) AS ¦~¥ð°²¼Æ From ¥ð°²°O¿ý " &_
- "Group By ¦~,©m¦W,°²§O Having sum(¤Ñ¼Æ)>2"
- CMD.CommandText=SQL
½Æ»s¥N½X °õ¦æµ²ªG¦p¤U¹Ï¡G
¹Ï9-11 ½d¨Òex09_05.php¡C |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|