¹ØÓÚ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 table±íÓиöÎı¾ÀàÐ͵Äa×ֶΣ¬´æ´¢µÄÄÚÈÝÈ«²¿ÊÇÊý×Ö£¬ÀýÈç2009001£¬2008578ÕâÑùµÄ¸ñʽ£»b×Ö¶ÎÎı¾ÀàÐÍ£¬´æµÄÒ²ÊÇÊý×ÖÀýÈç 001£¬123
aspÀïÃæ strday=100£¬strb=001
ÎÒÏë¶Á³ö£¬´Óa×ֶεÄÊý×Ö°´´óµ½Ð¡µÄË ......
²éѯ½á¹û¼¯£º
ps online totle
a 0 10
b 1 11
c 5 8
ÏëÏÔʾ³ÉÕâÑù ......
ÊDz»ÊÇÖ»ÄÜÔÚÖ´Ðд洢¹ý³ÌÖ®Ç°Ìæ»»µôÃô¸Ð×Ö·ûÁË£¿
Ó¦¸ÃÊǵģ¬¿ÉÒÔÓÃÕýÔòÈ¥Ìæ»»
ÒýÓÃ
Ó¦¸ÃÊǵģ¬¿ÉÒÔÓÃÕýÔòÈ¥Ìæ»»
µÃ´ç½ø³ßµÄÎÊÏ£¬³ýÁËÌæ»»µ¥ÒýºÅ£¬»¹ÐèÒªÌæ»»ÄÄÐ©ÄØ£¿Ð»Ð»~
C# code:
ÎÒ×Ô ......
±íÖÐÊÇÕâÑù£¬
²¿ÃźŠ²¿ÃÅÐÅÏ¢
1 ²¿ÃÅÒ»
2 ²¿ÃŶþ
3 ²¿ÃÅÈý
4& ......
×Ö¶Îaa,¹²ÓÐ178¸öÊý¾Ý,ÏÔʾʱÊÇÒ»ÁÐÖ±ÅÅÏÂÀ´µÄ,ÎÒÏëÈÃÕâ178¸öÊý¾Ý,ÿÁÐÖ»ÏÔʾ5¸ö,¶àÁÐÏÔʾÍê,ÈçºÎʵÏÖ?
¼ÓÒ»¸öIDENTITYTÁÐ,°´ID%5À´·Ö
ÒýÓÃ
¼ÓÒ»¸öIDENTITYTÁÐ,°´ID%5À´·Ö
ID-1/5À´·Ö
SQL co ......