group by用不用主要决定于条件,from也可以放进去,放着让自己挑,
>select count(field1) as f1 where .... group by field1
>tquery1.open;
>edit1.text:=inttostr(tquery1f1.value);
只要能达到目的就行了。
俺也来倒筒水:
with TQuery.Create(nil) do
begin
SQL.Add('Select Count(*) As Num From table Where ...');
Open;
Edit1.Text := IntToStr(FieldByName('Num').AsInteger);
Close;
Free;
end;