MySQL²éѯ±íÄÚÖظ´¼Ç¼
MySQL²éѯ±íÄÚÖظ´¼Ç¼
²éѯ¼°É¾³ýÖظ´¼Ç¼µÄ·½·¨
(Ò»)
1¡¢²éÕÒ±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΣ¨peopleId£©À´ÅжÏ
select * from people
where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)
2¡¢É¾³ý±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΣ¨peopleId£©À´Åжϣ¬Ö»ÁôÓÐrowid×îСµÄ¼Ç¼
delete from people
where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)
and rowid not in (select min(rowid) from people group by peopleId having count(peopleId )>1)
3¡¢²éÕÒ±íÖжàÓàµÄÖظ´¼Ç¼£¨¶à¸ö×ֶΣ©
select * from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
4¡¢É¾³ý±íÖжàÓàµÄÖظ´¼Ç¼£¨¶à¸ö×ֶΣ©£¬Ö»ÁôÓÐrowid×îСµÄ¼Ç¼
delete from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
and rowid not in (select min(rowid) from vitae group by peopleId,seq having count(*)>1)
5¡¢²éÕÒ±íÖжàÓàµÄÖظ´¼Ç¼£¨¶à¸ö×ֶΣ©£¬²»°üº¬rowid×îСµÄ¼Ç¼
select * from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
and rowid not in (select min(rowid) from vitae group by peopleId,seq having count(*)>1)
(¶þ)
±È·½Ëµ
ÔÚA±íÖдæÔÚÒ»¸ö×ֶΓname”£¬
¶øÇÒ²»Í¬¼Ç¼֮¼äµÄ“name”ÖµÓпÉÄÜ»áÏàͬ£¬
ÏÖÔÚ¾ÍÊÇÐèÒª²éѯ³öÔڸñíÖеĸ÷¼Ç¼֮¼ä£¬“name”Öµ´æÔÚÖظ´µÄÏ
Select Name,Count(*) from A Group By Name Having Count(*) > 1
Èç¹û»¹²éÐÔ±ðÒ²Ïàͬ´óÔòÈçÏÂ:
Select Name,sex,Count(*) from A Group By Name,sex Having Count(*) > 1
(Èý)
·½·¨Ò»
declare @max integer,@id integer
declare cur_rows cursor local for select Ö÷×Ö¶Î,count(*) from ±íÃû group by Ö÷×ֶΠhaving count(*) >£» 1
open cur_rows
fetch cur_rows into @id,@max
while @@fetch_status=0
begin
select @max = @max -1
set rowcount @max
delete from ±íÃû where Ö÷×ֶΠ= @id
fetch cur_rows into @id,@max
end
close c
Ïà¹ØÎĵµ£º
±¸·ÝÊý¾Ý¿âÃüÁî:
mysqldump -u root --password=root --database helloworld
>helloworld_backup.sql
ÆäËûÓ÷¨:
1.µ¼³öÕû¸öÊý¾Ý¿â
mysqldump -u Óû§Ãû -p Êý¾Ý¿âÃû > µ¼³öµÄÎļþÃû
mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql
2.µ¼³öÒ»¸ö±í
mysqldump -u Óû§Ãû -p Êý¾Ý¿âà ......
Ç°¼¸Ì칫˾ÈÃÎÒ×öCÓïÑÔºÍMySQLÊý¾Ý¿âµÄ½»»¥²Ù×÷£¬·ÑÁ˾ÅÅ£¶þ»¢Ö®Á¦Ö®ºó×ÜËã×ö³öÀ´ÁË£¬½ñÌìÌصذÑÔ´´úÂëÌù³öÀ´¹©´ó¼Òѧϰ£»ÈçÓÐÈËÏëÒª´ò°üÏîÄ¿¿ÉÒÔ¼ÓÎÒQQ260990509,×¢Ã÷¼¼Êõ½»Á÷£¬¼´¿É»ñµÃ´ò°üÖ®ºóµÄÏîÄ¿£¡
#if defined(_WIN32) || defined(_WIN64) //ΪÁËÖ§³Öwindowsƽ̨ÉϵıàÒë
#include <windows.h>
#end ......
1 Apache
ÐÞ¸Ä documentroot ¸ùĿ¼
directory ·ÃÎʸùĿ¼ȨÏÞ
directoryindex ĬÈÏÊ×Ò³ ......
Ò» Apache µÄ°²×°
1 Apache µÄ°²×°
2 ͬÒâÐÒé
3 ½Ó×Å "Next "
4 Ìîд ÓòÃû(network domain) ·þÎñÆ÷µÄÃû³Æ (Server Name) ¹ÜÀíÕßÓÊÏä(Administrator's Email)
5 °²×°ÀàÐÍ
6 Ñ¡Ôñ°²×°Â·¾¶
7 µã»÷“install ” ¼ÌÐø
8 ¿ªÊ¼°²×°
9 °²×°½áÊø
¶þ MySqlµÄ°²×°
......
ÔÚÊý¾Ý¿â
ÖУ¬UNION
ºÍUNION
ALL
¹Ø¼ü×Ö¶¼Êǽ«Á½¸ö½á¹û¼¯ºÏ²¢ÎªÒ»¸ö£¬µ«ÕâÁ½Õß´ÓʹÓúÍЧ
ÂÊÉÏÀ´Ëµ¶¼ÓÐËù²»Í¬¡£
MySQL
ÖÐ
µÄUNION
UNIONÔÚ½øÐбíÁ´½Óºó»áɸѡµôÖظ´µÄ¼Ç¼£¬ËùÒÔÔÚ±íÁ´½Óºó»á¶ÔËù²úÉúµÄ½á¹û¼¯½øÐÐÅÅÐòÔËË㣬ɾ³ýÖظ´µÄ¼Ç¼ÔÙ
·µ»Ø½á¹û¡£Êµ¼Ê´ó²¿·ÖÓ¦ÓÃÖÐÊDz»»á²úÉúÖظ´µÄ¼Ç¼£¬×î³£¼ûµÄÊǹý³Ì± ......