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

mysql distinct ¶Ô¶à×ֶιýÂ˲»ÕýÈ·µÄ½â¾ö·½·¨


ÏÂÃæÏÈÀ´¿´¿´Àý×Ó£º
    table
  id name
  1 a
  2 b
  3 c
  4 c
  5 b
¿â½á¹¹´ó¸ÅÕâÑù£¬ÕâÖ»ÊÇÒ»¸ö¼òµ¥µÄÀý×Ó£¬Êµ¼ÊÇé¿ö»á¸´Ôӵöࡣ
±ÈÈçÎÒÏëÓÃÒ»ÌõÓï¾ä²éѯµÃµ½name²»Öظ´µÄËùÓÐÊý¾Ý£¬ÄǾͱØÐëʹÓÃdistinctÈ¥µô¶àÓàµÄÖظ´¼Ç¼¡£
select distinct name from table
µÃµ½µÄ½á¹ûÊÇ:
  name
  a
  b
  c
ºÃÏñ´ïµ½Ð§¹ûÁË£¬¿ÉÊÇ£¬ÎÒÏëÒªµÃµ½µÄÊÇidÖµÄØ£¿¸ÄһϲéѯÓï¾ä°É:
select distinct name, id from table
½á¹û»áÊÇ:
  id name
  1 a
  2 b
  3 c
  4 c
  5 b
distinctÔõôûÆð×÷Óã¿×÷ÓÃÊÇÆðÁ˵ģ¬²»¹ýËûͬʱ×÷ÓÃÁËÁ½¸ö×ֶΣ¬Ò²¾ÍÊDZØÐëµÃidÓëname¶¼ÏàͬµÄ²Å»á±»Åųý¡£¡£¡£¡£¡£¡£¡£
½â¾ö·½·¨: select id, name from table group by name
¹þ¹þ£¡ÇëÊÊÓ¦MYSQLµÄд·¨°É


Ïà¹ØÎĵµ£º

MySQL Order ByË÷ÒýÓÅ»¯

ÔÚһЩÇé¿öÏ£¬MySQL¿ÉÒÔÖ±½ÓʹÓÃË÷ÒýÀ´Âú×ãÒ»¸ö ORDER BY »ò GROUP BY ×Ó¾ä¶øÎÞÐè×ö¶îÍâµÄÅÅÐò¡£¾¡¹Ü ORDER BY ²»ÊǺÍË÷ÒýµÄ˳Ðò׼ȷƥÅ䣬Ë÷Òý»¹ÊÇ¿ÉÒÔ±»Óõ½£¬Ö»Òª²»ÓõÄË÷Òý²¿·ÖºÍËùÓеĶîÍâµÄ ORDER BY ×Ö¶ÎÔÚ WHERE ×Ó¾äÖж¼±»°üÀ¨ÁË¡£ ¡¡¡¡Ê¹ÓÃË÷ÒýµÄMySQL Order By ¡¡¡¡ÏÂÁеļ¸¸ö²éѯ¶¼»áʹÓÃË÷ÒýÀ´½â¾ö ORDER BY ......

Á˽âMySQLÊý¾Ý¿âËø¶¨»úÖÆ

Èç¹ûÒªÁ˽âMySQLÊý¾Ý¿âËø¶¨»úÖÆ£¬Ê×ÏÈÁ˽âÒ»ÏÂMySQLµÄÈýÖÖËø¶¨ÀàÐÍ£º
Ò»£¬Ðм¶Ëø¶¨
¶þ£¬±í¼¶Ëø¶¨
Èý£¬Ò³¼¶Ëø¶¨
ÕâÈýÖÖËø¶¨ÀàÐÍ£¬ÔÚMySQLÊý¾Ý¿âÖÐʹÓÃÈçÏ£º
Ðм¶Ëø¶¨£ºMyISAM£¬Memory£¬CSV[·ÇÊÂÎñÐԵĴ洢ÒýÇæ]
±í¼¶Ëø¶¨£ºInnoDB£¬NDB Chuster
Ò³¼¶Ëø¶¨£ºBerkeley DB
Á½ÖÖËø¶¨»úÖÆ£º¶ÁËø¶¨ºÍдËø¶¨
MySQLÊý¾Ý¿âËø¶ ......

MySQLÊý¾Ý¿âÉè¼ÆÔ­Ôò

ת×Ô http://www.supidea.com/post/mysql_design_database.aspx
MySQLÊý¾Ý¿âÉè¼ÆÔ­Ôò
MySQL¶ÔÓÚ³ÉΪһ¸ö·Ç³£¿ìËÙµÄÊý¾Ý¿â·þÎñÆ÷ÓÐ×ŵ±Ö®ÎÞÀ¢µÄÃûÉù£¬ËüÒ²·Ç³£ÈÝÒ×ÉèÖúÍʹÓá£Ëæ×ÅËü×÷ΪÍøÕ¾ºó¶ËÊý¾Ý¿âµÃÉùÍûÈÕÔö£¬ÆäЧ¹ûÔÚÈ¥Ä꿪ʼÓÐÃ÷ ÏÔÌá¸ß¡£µ«ÊǺܶàMySQLÓû§¸ü¶àµØÖªµÀÈçºÎ´´½¨Ò»¸öÊý¾Ý¿â²¢±àд¶ÔËüµÄ²éѯ¡£¾ÍÏñ³ÉÇ ......

VCÖÐÓÃADO²Ù×÷MySqlÊý¾Ý¿âÖÐÎÄÎÊÌâ

      ÎҵijÌÐòÊÇÓÃADOÀ´Á¬½ÓMysqÊý¾Ý¿âµÄ£¬ÕâÊÇÔ­ÏÈдºÃÓÃÔÚMSSQLÉϵģ¬¸ÄÁËÏÂÁ¬½Ó×Ö·û´®£¬ËùÒÔÒ²¾ÍûÓÐÓÃMySql C++ APIÀ´ÖØÐÂдÁË¡£¸Õ¿ªÊ¼Ê¹ÓÃMySql£¬Óöµ½µÄÎÊÌâ×ÜÊÇÌرðµÄ¶à£¬ÏÖÔÚÓÖÓöµ½Ò»¸öÖ÷Òªsql×Ö·û´®ÖÐÓÐÖÐÎľͱ¨´íµÄÎÊÌ⣬ûÓÐÖÐÎÄÒ»ÇÐÕý³££¬ÕûÕûŪÁËÒ»¸öÉÏÎ磬ÔÚÍøÉÏÒ²ÕÒÁ˺ܶà×ÊÁÏ£¬·¢ ......

MysqlÎÊÌâ»ã×Ü

1£¬Mysql²åÈë¶þ½øÖÆ´ó¶ÔÏó³öÏÖÒì³££¬²åÈë¶þ½øÖƳöÏÖÒì³££¬Ôõô½â¾öcom.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
½â¾ö°ì·¨£ºurl=url=+"?useUnicode=true& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ