A±í B±í WZID WZJG WZID CKID WZSL ÏÖÔÚÒª²é¶ÔÓ¦µÄÿһ¸öCKIDϵÄ×ܵĽð¶î ¾ÍÊÇÏȲéÿ¸öWUIDÔÚB±íÀïµÄÊýÁ¿£¬È»ºóÓÃWZJG*sum(wzsl)£¬È»ºóÔÙ°´ÕÕÿ¸öCKIDÈ¥sum(WZJG*sum(wzsl)) Ò»Ìõsql£¬Ð»Ð»°¡£¡ Äܲ»ÄÜ˵µÄÃ÷°×µã£¬ÄãµÄWUIDÊÇʲô°¡£¬ÄãµÄB±íÀﶼûÓÐ SELECT B.Ckid,sum(A.Wzjg*b.wzsl) from A, B WHERE A.Wzid=B.Wzid GROUP BY B.Ckid µÚÒ»Õűíÿ¸öÎï×ÊÓÐ×Ô¼ºµÄ¼Æ»®¼Û µÚ¶þÕűíÿ¸öÎï×ÊÔÚ²»Í¬µÄ¿â룬Óв»Í¬µÄÊýÁ¿ Ê×ÏÈҪͳ¼ÆÔÚͬһ¸ö¿âλµÄͬһ¸öÎï×ʵÄÊýÁ¿£¬È»ºó°ÑÕâ¸öÊýÁ¿³ËÉ϶ÔÓ¦Îï×ʵļƻ®¼ÛµÃ³öÎï×ʽð¶î£¬È»ºóÔÙͳ¼Æÿ¸ö¿âλÀïµÄËùÓÐÎï×ʽð¶îÖ®ºÍ òËƶþÂ¥ÒѾ²î²»¶àÁË,²»ÓÃÂ¥Ö÷×Ô¼ºÃèÊöµÃÕâô¸´ÔÓ
Â¥Ö÷¿ÉÒÔÊÔÊÔ¸ø³öµÄSQL¡£¡£¡£¡£ ²»ÓðÑÄã×Ô¼ºµÄ¾ßÌåÒµÎñÃèÊöµÄÕâôÇå³þ¡£¡£¡£¡£¡£¡£ Â¥Ö÷µÄÒâ˼¿ÉÊÇ£¿ select t2.ckid,sum(t1.s) from( select a.wzid,a.wzjg*sum(b.wzsl)s from a,b where a.wzid=b.wzid group by a.wzid,w.wzjg)t1, b t2 where t1.wzid=t2.wzid group by t2.ckid
СµÜÎÒÓÃADOÁ¬½ÓSQL server 2000Êý¾Ý¿â£¬È»ºóÔÚDBGridÖÐÏÔʾ£¬ÏÖÔÚÏë°ÑÔÚDBGridÖвéѯµ½µÄÊý¾ÝiPlot×÷ͼ£¬ÇëÎÊÈçºÎʵÏÖÔÚDBGridÖеÄÊý¾Ý¶ÁÈ¡£¬¶Á³öµÄÊý¾ÝÊÇSTRINGÀàÐ͵ģ¬ÈçºÎÓÐЧµÄת±ä³ÉÊý¾Ý¿âÖÐËù´æ´¢µÄDOUBLEÀàÐ ......