¹ØÓÚ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×ֶεÄÊý×Ö°´´óµ½Ð¡µÄË ......
users±í
name companyId companyName
company±í
companyId companyName
1 a¹«Ë¾
2 b¹«Ë¾
......
ÎÊÌâÊÇÕâÑùµÄ£¬
Îҵı¾µØsqlserver 2000 ·þÎñÆ÷ÉÏ£¬½¨Á¢Á˶à¸öÔ¶³ÌÁ´½Ó·þÎñÆ÷£¬
ÇëÎÊ£¬ÎÒÈçºÎͨ¹ý sqlÓï¾ä£¬»òÕßÆäËûµÄ·½·¨Ã¶¾Ù ÕâЩÁ´½Ó·þÎñÆ÷ÄØ£¿£¨Í¨¹ýÆóÒµ¹ÜÀíÆ÷ÎÒÊÇÖªµÀµÄ£¬
ÎÒÒªµÄÊÇÄÜͨ¹ý±à³Ìö¾Ùµ½ ......
±íÖÐÊÇÕâÑù£¬
²¿ÃźŠ²¿ÃÅÐÅÏ¢
1 ²¿ÃÅÒ»
2 ²¿ÃŶþ
3 ²¿ÃÅÈý
4& ......