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

¹ØÓÚgroup byµÄsqlÓï¾ä£¿

  with adod_dict do
    begin
    close;
    commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd=:tnd group by bgqxcode';
    parameters[0].DataType:=ftstring;
    parameters[0].Value:=trim(cbtjnd.Text);
    open;
    end;

ÒÔÉÏÊÇdelphiÖеÄÓï¾ä£¬ÔËÐÐʱ£¬ÀÏÊDZ¨ora-00979 ²»ÊÇ group by ±í´ïʽ?

ORA-00979 not a GROUP BY expression

Cause: The GROUP BY clause does not contain all the expressions in the SELECT clause. SELECT expressions that are not included in a group function, such as AVG, COUNT, MAX, MIN, SUM, STDDEV, or VARIANCE, must be listed in the GROUP BY clause.

Action: Include in the GROUP BY clause all SELECT expressions that are not group function arguments.


ÈôÊǸÄΪselect bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd¡®2004¡¯group by bgqxcode ÔÚ sql plus ÖÐÄÜÕý³£ÔËÐÐ


"´øÓÐ group by ×Ó¾äµÄ²éѯÖÐµÄ select ×Ö¶ÎÁбíÖУ¬³ýÁ˰üº¬ÔÚ group by ÖеÄ×ֶΣ¬ÆäËû×ֶζ¼ÒªÇó×÷Ϊ group function £¨±ÈÈç AVG, COUNT, MAX, MIN, SUM £©µÄ²ÎÊý³öÏÖ£¬ÄãµÄ×Ó²éѯΥ×÷ΪÖ÷²éѯµÄÒ»¸ö×Ö¶ÎÎ¥·´ÁËÕâ¸ö¹æÔòÁË¡£"

ÈôÊǸÄΪselect bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd='2004' group by bgqxcode ÔÚ sql plus ÖÐÄÜÕý³£ÔËÐÐ


bobo_916 ÄܰïÎÒ¸ÄÏÂÕâÌõSQLÓï¾äÂð£¿Ð»Ð»

Óï¾ä±¾ÉíûÓÐÎÊÌâ
ÊÔÊÔÓÃd


Ïà¹ØÎÊ´ð£º

ÇóSQL£¿

´ó¼ÒºÃ£¬ÇëÎÊÔÚ±íMÖÐÓÐ×ֶΣºa b c d e 
ÎÒÏë²é³öÆäÖÐÂú×ãÏÂÃæÈÎÒâÒ»ÏîµÄÊý¾Ý£¬1.×Ö¶Îa µÄÖµ²»ÊÇ ¡®Êé»ò±Ê»ò±¾¡¯ÖÐÈÎÒ»£¬2.aΪÊéµÄʱºò×Ö¶Îb,cÊÇ¿Õ;3.µ±aֵΪ±ÊµÄʱºòdÊÇ¿Õ;4.µ±aΪ±¾µÄʱºòb,d,e¶¼ÊÇ¿Õ;5.È ......

ÇósqlÓï¾ä½«Êý¾Ý¿â±íijЩ×ֶεÄÄÚÈÝ·­10±¶

Êý¾Ý¿âij±í£¬Ï뽫ÆäÖÐf1,f2Á½¸ö×ֶεÄÄÚÈÝ·­10±¶£¬Çë½ÌÈçºÎд·¨£¿
update tbl set f1= f1*10£¬f2= f2*10 where id=10451
ÕâÖÖд·¨»áÔì³Éplsql¿¨ËÀ
²»»á°É£¬ÄǸöid=10451 µÄÊý¾ÝÓжàÉÙ°¡~~~~

ÎÒ¹À¼ÆsqlÊDz» ......

sql ´æ´¢¹ý³Ì ¶¯Ì¬±í DateTimeÊý¾ÝÀàÐÍ Ìí¼ÓÎÊÌâ

ÎÒµÄÊý¾Ý¿âµÄ±íÊǶ¯Ì¬µÄ±í,ÔÚÌí¼ÓÊý¾ÝµÄʱºòÓÐÒ»¸ö×Ö¶ÎÊÇDATETIMEÊý¾ÝÀàÐ͵Ä,ÏÂÃæÊÇ´æ´¢¹ý³Ì
if exists (select * from sysobjects where name='proc_ADD_Order')
drop proc proc_ADD_Order
go
......

sql server 2005 Ææ¹ÖµÄÎÊÌâ ¹ØÓÚÃû×ֵĶ¨Î»

sql server 2005 ´¥·¢Æ÷ Ö´ÐÐsp_executesql µÄÎÊÌâ
db1,db2ÊÇÒ»¸ö·þÎñÆ÷ server µÄ2¸öÊý¾Ý¿â

db1µÄtable1  ½¨Á¢Ò»¸öafter update´¥·¢Æ÷ ,µ± update  table1 ºó½¨Á¢Ò»¸ö¸´ÖÆ±íµ½  db2µÄtabl ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ