Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

MySQLÖÐÓÃselectʵÏÖTOP N¹¦ÄÜ ¼°·ÖÒ³


MySQLÖÐÓÃselectʵÏÖTOP N¹¦ÄÜ
ÏÈ˵¼¸¸ö¹Ø¼ü×Ö£º
distinct ·µ»Ø²»Öظ´µÄ¶àÁÐ
count() ¼ÆÊý
limit m,n µÚm¸öÆðn¸ö
 
ÄÇô£¬Èç¹ûÐèÒª²éÕÒÃûΪcolµÄijһ¸öÁеÄTop N£¬²¢Áгö¶ÔÓ¦µÄÖµµÄselectÓï¾ä¾ÍÈçÏ£º
select dinstinct(col),count(col) from tablename group by 1 order by 2 desc limit 0,N;


Ïà¹ØÎĵµ£º

ubuntuϸü¸ÄmysqlĬÈϱàÂë(×Ö·û¼¯)

ubuntuϸü¸ÄmysqlĬÈϱàÂë(×Ö·û¼¯)
http://blog.csdn.net/zzuduoduo/archive/2009/05/02/4142504.aspx
°²×°mysql
sudo apt-get install mysql-server #Ö±½Ó×Ô¶¯»ñµÃ¿ÉÓð汾
Ò²¿ÉÒÔÕâÑùд
sudo apt-get install mysql-server-5.0 #°²×°mysql·þÎñÆ÷5.0°æ±¾
°²×°ºó
/etc/init.d/mysql start (stop) ΪÆô¶¯ºÍÍ£Ö¹·þÎñÆ ......

ÈçºÎд³ö¸ßÐÔÄܵÄMySQL²éѯ

ÏëдÕâÑùһƪÎÄÕºܾÃÁË£¬µ«Ê¼ÖÕûÓÐÏÂÊÖ¡£×î½ü°ïͬÊ¿´Á˼¸¸ö²éѯ£¬¶øÇÒ×Ô¼ºÒ²ÔÚ¿¼ÂÇÒ»¸öË÷ÒýϵͳµÄÎÊÌ⣬ËùÒÔ½ñÌì¾Í°ÑÕâ¸öдÁË¡£½éÉÜÒ»ÏÂMySQLµÄË÷Òý»úÖÆ£¬»¹ÓÐһЩMySQL²éѯµÄÓÅ»¯²ßÂÔ¡£±ÉÈ˲ÅÊèѧdz£¬ºÜ¿ÉÄÜ˵µÄ²»¶Ô£¬Çë·¹ýµÄ¸÷λ´óÏÀÅúÆÀÖ¸Õý£¬Ï׳óÁË¡£
------------------- jiajun.org ¹Ù·½·Ö¸îÏß ---------------- ......

linux mysql php apache ÅäÖð²×°

 ¡¡ÎÒÃÇ°ÑÏÂÔصÄÈý¸öÈí¼þ°ü·Åµ½/var/localĿ¼Ï£¨ÕâÊDZÊÕ߸öÈ˵ÄÏ°¹ß£©£¬ËüÃǶ¼ÊÇtar.gz°ü£¬¿ÉÒÔÓÃÃüÁîtar -xzpvf °üÃû£¬°ÑËüÃÇÔÚµ±Ç°Ä¿Â¼£¨/var/local/£©Öн⿪£º
cd /var/local
tar -xzpvf mysql-4.0.15.tar.gz
tar -xzpvf php-4.3.3.tar.gz
tar -xzpvf httpd-2.0.47.tar.gz
¡¡¡¡½â°üºó¿ÉÒÔ¿ªÊ¼½øÈëÕýʽ°²×°¡£ ......

ʹÓÃMySQL connector/C++Á´½ÓMySQLÊý¾Ý¿â

Ê×ÏÈÈ¥MySQL¹ÙÍøÏÂÔØMySQL connector/C++
http://dev.mysql.com/downloads/connector/cpp/1.0.html
ÏÂÔصڶþ¸ö°ü£¬windows32λ·Ç°²×°°æ£¨¸öÈ˾õµÃÕâ¸ö°ü¸É¾»£©¡£Ä¿Ç°µÄ°æ±¾ÊÇConnector/C++ 1.0.5¡£
Windows (x86, 32-bit), ZIP Archive
(mysql-connector-c++-noinstall-1.0.5-win32.zip)
½«Õû¸ö°ü½âѹµ½ÏîÄ¿Îļþ¼Ðϵ ......

MySQLÊý¾Ý¿â±¸·ÝºÍ»¹Ô­µÄ³£ÓÃÃüÁî

±¸·ÝMySQLÊý¾Ý¿âµÄÃüÁî
mysqldump -hhostname -uusername -ppassword databasename > backupfile.sql
±¸·ÝMySQLÊý¾Ý¿âΪ´øɾ³ý±íµÄ¸ñʽ
±¸·ÝMySQLÊý¾Ý¿âΪ´øɾ³ý±íµÄ¸ñʽ£¬Äܹ»Èøñ¸·Ý¸²¸ÇÒÑÓÐÊý¾Ý¿â¶ø²»ÐèÒªÊÖ¶¯É¾³ýÔ­ÓÐÊý¾Ý¿â¡£
mysqldump -–add-drop-table -uusername -ppassword databasename > backu ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ