You are not logged in.
Pages: 1
use ADO i write for count all man:
query.SQL.Text := 'select count(id) as cnt from table where Sex = "M"';
query.Open;
ManCount := query.FieldByName('cnt').AsInteger;
or
query.SQL.Text := 'select id from table where Sex = "M"';
query.Open;
ManCount := query.RecordCount;
how use framework qiuck count Man?
Mans := Database.List([TSQLPatients], '*','Sex = "М"').RowCount;
this code work, but is a good way??
what other way can count the number of people with the condition?
Last edited by noobies (2011-10-05 09:39:31)
Offline
You can use Count(*) as field name if you want to.
This will be executed as plain SQL by mORMot. Even the In-Memory pure Delphi databases implements count(*).
If you only need to retrieve the row count, it will be faster than using the RowCount method, which will retrieve all data rows as JSON from server, so will be slower.
Offline
Pages: 1