mysqlÎÊÌ⣬¹òÇó¸ßÊÖ½â´ð
select c.globalUid,c.badge,temp.sumB,temp.sumP from tb_user c,(select a.uid,sum(a.badge) as sumB,IFNULL(sum(b.propertyNum),0) as sumP,sum(a.badge)-IFNULL(sum(b.propertyNum),0) as cha from tb_buyfun_log a left join buyrecord b on a.uid=b.globaluid group by a.uid having cha>500) as temp where uptime>'2009-12-01 00:00:00' and globaluid=temp.uid
˰ïæÓÅ»¯ÏÂÕâÓï¾ä£¬ÎÒÔÚµçÄÔÉÏÔËÐкóºÜÂý£¬ÓÐʱ°ëÌì¶¼²»³öÀ´£¬ÓÐʱÁ¬²éѯ¹¤¾ß¶¼¸ãÆðËÀµô£¬¹ØÒ²¹Ø²»ÁË£¬ ¸÷λ¸ßÊÖ°ïæ¿´Ïºò»£¿
SQL code:
select c.globalUid,c.badge,temp.sumB,temp.sumP
from tb_user c,(
select a.uid,sum(a.badge) as sumB,
IFNULL(sum(b.propertyNum),0) as sumP,
sum(a.badge)-IFNULL(sum(b.propertyNum),0) as cha
from tb_buyfun_log a left join buyrecord b on a.uid=b.globaluid
group by a.uid
having cha>500
) as temp
where uptime>'2009-12-01 00:00:00' and globaluid=temp.uid
ÄãÕâÊǸöµÑ¿¨»ý°¡¡£
Ìù³öÄãµÄ
show index from tb_user
show index from tb_buyfun_log
show index from buyrecord
ÒÔ¼°
explain select c.globalUid,c.badge,temp.sumB,temp.sumP
from tb_user c,(
select a.uid,sum(a.badge) as sumB,
IFNULL(sum(b.propertyNum),0) as sumP,
sum(a.badge)-IFNULL(sum(b.propertyNum),0) as cha
from tb_buyfun_log a left join buyrec
Ïà¹ØÎÊ´ð£º
ÎÒÊÇÓÃmysql×Ô´øµÄC API
if(mysql_real_connect(&mysql,"125.0.0.108","root","root","home",3306,NULL,0))
{
AfxMessageBox("Êý¾Ý¿âÁ¬½Óʧ°Ü") ......
Õâ¸öÊÓÆµ½²µÄºÜÏêϸ, ¶ÔÐÂÊַdz£ÓÐÓÃ, »ù±¾ÉÏÒ»¿´¾Í¶®
ÓÉÓÚÌ«´óÁË(50m, ÎÒÖ»ÄÜÉÏ´«20m), ÎÒÉÏ´«²»ÁË, Ö»ºÃÌù³öÏÂÔØµØÖ·
ÏÂÔØµØÖ·: http://ftel1.3800hk.com/0807/080720djxnzj.rar
ºÃ¶«Î÷,ϸö¿´¿´
......
ÎÒÊÇÐÂÊÖ£¬³õѧMYSQL£¬Óкܶ಻¶®£¬Íû´Í½Ì£¡£¡
±ÈÈç˵ÎÒн¨Ò»¸öMYSQLÊý¾Ý¿âUSER Êý¾Ý¿âÖÐÓбíLIST
È»ºóÎÒÔÚVCÖÐн¨Ò»¸öMFC¶Ô»°¿ò¹¤³Ì£¬È»ºóÎÒÔõôÑù²ÅÄÜÓÃVC»ñµÃÊý¾Ý¿âÖбíµÄÊý¾Ý£¿
Ï£Íû¸ø³ö¾ßÌåµÄ²Ù×÷² ......