MySQLÖÐUNION
ÔÚÊý¾Ý¿âÖУ¬UNIONºÍUNION ALL¹Ø¼ü×Ö¶¼Êǽ«Á½¸ö½á¹û¼¯ºÏ²¢ÎªÒ»¸ö£¬µ«ÕâÁ½Õß´ÓʹÓúÍЧÂÊÉÏÀ´Ëµ¶¼ÓÐËù²»Í¬¡£
MySQLÖеÄUNION
UNIONÔÚ½øÐбíÁ´½Óºó»áɸѡµôÖظ´µÄ¼Ç¼£¬ËùÒÔÔÚ±íÁ´½Óºó»á¶ÔËù²úÉúµÄ½á¹û¼¯½øÐÐÅÅÐòÔËË㣬ɾ³ýÖظ´µÄ¼Ç¼ÔÙ·µ»Ø½á¹û¡£Êµ¼Ê´ó²¿·ÖÓ¦ÓÃÖÐÊDz»»á²úÉúÖظ´µÄ¼Ç¼£¬×î³£¼ûµÄÊǹý³Ì±íÓëÀúÊ·±íUNION¡£È磺
select * from gc_dfys union select * from ls_jg_dfys
Õâ¸öSQLÔÚÔËÐÐʱÏÈÈ¡³öÁ½¸ö±íµÄ½á¹û£¬ÔÙÓÃÅÅÐò¿Õ¼ä½øÐÐÅÅÐòɾ³ýÖظ´µÄ¼Ç¼£¬×îºó·µ»Ø½á¹û¼¯£¬Èç¹û±íÊý¾ÝÁ¿´óµÄ»°¿ÉÄܻᵼÖÂÓôÅÅ̽øÐÐÅÅÐò¡£
MySQLÖеÄUNION ALL
¶øUNION ALLÖ»ÊǼòµ¥µÄ½«Á½¸ö½á¹ûºÏ²¢ºó¾Í·µ»Ø¡£ÕâÑù£¬Èç¹û·µ»ØµÄÁ½¸ö½á¹û¼¯ÖÐÓÐÖظ´µÄÊý¾Ý£¬ÄÇô·µ»ØµÄ½á¹û¼¯¾Í»á°üº¬Öظ´µÄÊý¾ÝÁË¡£
´ÓЧÂÊÉÏ˵£¬UNION ALL Òª±ÈUNION¿ìºÜ¶à£¬ËùÒÔ£¬Èç¹û¿ÉÒÔÈ·ÈϺϲ¢µÄÁ½¸ö½á¹û¼¯Öв»°üº¬Öظ´µÄÊý¾ÝµÄ»°£¬ÄÇô¾ÍʹÓÃUNION ALL£¬ÈçÏ£º
select * from gc_dfys union all select * from ls_jg_dfys
ʹÓÃUnion£¬ÔòËùÓзµ»ØµÄÐж¼ÊÇΨһµÄ£¬ÈçͬÄúÒѾ¶ÔÕû¸ö½á¹û¼¯ºÏʹÓÃÁËDISTINCT
ʹÓÃUnion all£¬Ôò²»»áÅÅÖØ£¬·µ»ØËùÓеÄÐÐ
Èç¹ûÄúÏëʹÓÃORDER BY»òLIMIT×Ó¾äÀ´¶ÔÈ«²¿UNION½á¹û½øÐзÖÀà»òÏÞÖÆ£¬ÔòÓ¦¶Ôµ¥¸öµØSELECTÓï¾ä¼ÓÔ²À¨ºÅ£¬²¢°ÑORDER BY»òLIMIT·Åµ½×îºóÒ»¸öµÄºóÃ棺
(SELECT a from tbl_name WHERE a=10 AND B=1)
UNION
(SELECT a from tbl_name WHERE a=11 AND B=2)
ORDER BY a LIMIT 10;
Âé·³Ò»µãÒ²¿ÉÒÔÕâô¸É£º
select userid from (
select userid from testa union all select userid from testb) t
order by userid limit 0,1;
Èç¹ûÄ㻹Ïëgroup by£¬¶øÇÒ»¹ÓÐÌõ¼þ£¬ÄÇô£º
select userid from (select userid from testa union all select userid from testb) t group by userid having count(userid) = 2;
×¢Ò⣺ÔÚunionµÄÀ¨ºÅºóÃæ±ØÐëÓиö±ðÃû£¬·ñÔò»á±¨´í
µ±È»ÁË£¬Èç¹ûµ±unionµÄ¼¸¸ö±íµÄÊý¾ÝÁ¿ºÜ´óʱ£¬½¨Ò黹ÊDzÉÓÃÏȵ¼³öÎı¾£¬È»ºóÓýű¾À´Ö´ÐÐ
ÒòΪ´¿´âÓÃsql£¬Ð§ÂÊ»á±È½ÏµÍ£¬¶øÇÒËü»áдÁÙʱÎļþ£¬Èç¹ûÄãµÄ´ÅÅ̿ռ䲻¹»´ó£¬¾ÍÓпÉÄÜ»á³ö´í
Error writing file '/tmp/MYLsivgK' (Errcode: 28)
Ïà¹ØÎĵµ£º
[תÌûÍøÖ·]http://java-2007.javaeye.com/blog/622269
Íü¼ÇMySQL(ºÍPHP´îÅäÖ®×î¼Ñ×éºÏ) ROOTÃÜÂëÊÇÔÚMySQL(ºÍPHP´îÅäÖ®×î¼Ñ×éºÏ)ʹÓÃÖкܳ£¼ûµÄÎÊÌ⣬¿ÉÊÇÓкܶàÅóÓѲ¢²»»áÖØÖÃROOTÃÜÂ룬Äǽпడ£¬ÎÒÓÐÉîÓид¥£¬ÌØд´ËÎÄÕÂÓë´ó¼Ò½»Á÷£º
1¡¢±à¼MySQL(ºÍPHP´îÅäÖ®×î¼Ñ×éºÏ)ÅäÖÃÎļþ£º
windows»·¾³ÖУº%MySQL(ºÍPHP´îÅäÖ ......
Windows:
1. ÓÃϵͳ¹ÜÀíÔ±µÇ½ϵͳ¡£
2. Í£Ö¹MySQLµÄ·þÎñ¡£
3. ½øÈëÃüÁî´°¿Ú(cmd)£¬È»ºó½øÈëMySQLµÄ°²×°Ä¿Â¼£¬±ÈÈçÎҵݲװĿ¼ÊÇc:\mysql,½øÈëC:\mysql\bin
4. Ìø¹ýȨÏÞ¼ì²éÆô¶¯MySQL£¬
c:\mysql\bin>mysqld-nt --skip-grant-tables
5. ÖØдò¿ªÒ»¸öcmd´°¿Ú£¬½øÈëc:\mysql\b ......
MySQLÖØа²×°µÄʱºò³öÏÖÁËÎÊÌ⣺Could not start the service MySQL. Error:0,ÔÒòÊÇûÓжԾɵÄMySQLÍêȫжÔصô¡£
ÔÚÄã´ÓµçÄÔÀïжÔؾɵÄMYSQLÊý¾Ý¿â·þÎñʱ£¬Ê×ÏÈÏÈÔÚWINDOWS·þÎñÀïÍ£µôMYSQLµÄ·þÎñ¡£ÔÙµ½¿ØÖÆÃæ°åÀïµÄÔö¼Óɾ³ý³ÌÐòÄÚ½øÐÐɾ³ý£¬È»ºóÊÖ¶¯É¾³ýÔ°²×°Îļþ,µ«ÊÇÄã²¢²»ÄÜÍêÕûµÄ°ÑMYSQL·þÎñɾ ......
Îļþphp.ini·ÅÈëwindowsÏ£¬½«ÏÂÃæÄÚÈÝ¿½±´µ½¼Çʱ¾ÃüÃûΪphp.ini·ÅÈëc:/windowsÏÂ,ÖØÆôApache server£º
[PHP]
;;;;;;;;;;;
; WARNING ;
;;;;;;;;;;;
; This is the default settings file for new PHP installations.
; By default, PHP installs itself with a configuration suitable for
; development purposes ......
CENTOS 5µÄÐéÄâ»ú£¬Ôõô´ÓͼÐνçÃæÇл»µ½ÃüÁîÐнçÃæ
1.ÁÙʱÇл»£º
ctrl+alt+1 …… ctrl+alt+6Ò»¹²Áù¸ö¿ØÖÆ̨¡£
2.ÓÀ¾Ã¹Ø±ÕͼÐλ¯£º
ÔÚrootÏÂÊäÈë vi /etc/inittab ½«init:5ÐÞ¸ÄΪinit:3
Mysql rpm°ü°²×°£¬²»ÄÜÖض¨Î»(relocatable)
rpm°ü°²×°Òì³££¬--prefix ²ÎÊý²»ÄÜÖض¨Î»£¬°²×°µ½ÁíÒ»¸öĿ¼µÄÔ ......