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

ÇóÒ»¸ösqlÓï¾ä

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

ÒýÓÃ
µÚÒ»Õűíÿ¸öÎï×ÊÓÐ×Ô¼ºµÄ¼Æ»®¼Û
µÚ¶þÕ


Ïà¹ØÎÊ´ð£º

oracle sql developer ²éѯÏÔʾÖÐÎÄÂÒÂë

»·¾³£º1.win2003server+oracle9i
2.oracle9i×Ö·û¼¯ÎªAMERICAN_AMERICA.WE8ISO8859P1
3.oracle sql developer°æ±¾ 1.5.5
ÏÖÏóÃèÊö: 1.ÔÚsql developer ÖвéѯoracleÖеÄij¸ö±í£¬ÖÐÎÄÈ«²¿ÏÔʾΪÂÒÂë¡£ ......

sqlÓï¾ä¶à±í¶à×ֶβéѯ - MS-SQL Server / »ù´¡Àà

ÎÒÓжà¸ö±íA B C ½á¹¹ÊÇÒ»ÑùµÄ£¬¶¼ÓÐ2¸ö×Ö¶ÎnameºÍcontent,ÎÒÒªËÑË÷ËùÒÔ±íËùÓÐ×Ö¶ÎÖаüº¬¡°Öйú¡±µÄÄÚÈÝ Õâ¸öSQLÓï¾äÔõôд 

ÈçºÎ½«¶à¸ö±íµÄ²éѯ½á¹ûÁ¬³ÉÒ»¸ö±í Õâ¸öSQLÓï¾äÔõôд ±íµÄ½á¹¹ÊÇÒ»ÑùµÄ
ÀýÈç£ ......

jspÁ´½Ósql2000µÄÒÉÎÊ£¿



type Exception report


message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jas ......

¹ØÓÚDelphiʹÓÃADOÁ¬½ÓSQL server 2000Êý¾Ý¿âµÄÎÊÌâ

СµÜÎÒÓÃADOÁ¬½ÓSQL server 2000Êý¾Ý¿â£¬È»ºóÔÚDBGridÖÐÏÔʾ£¬ÏÖÔÚÏë°ÑÔÚDBGridÖвéѯµ½µÄÊý¾ÝiPlot×÷ͼ£¬ÇëÎÊÈçºÎʵÏÖÔÚDBGridÖеÄÊý¾Ý¶ÁÈ¡£¬¶Á³öµÄÊý¾ÝÊÇSTRINGÀàÐ͵ģ¬ÈçºÎÓÐЧµÄת±ä³ÉÊý¾Ý¿âÖÐËù´æ´¢µÄDOUBLEÀàÐ ......

ÇóÒ»sqlÓïÃû

ÏÖÔÚÓÐa1,a2Á½±í
a1
id name aa cc
001 aaaa bbb cc
002 bbb bbb bbb
003 ccc ccc ccc
004 ddd ddd ddd
005 eee eee eee
a2
id ida2 ff b ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ