How can I calculate sql tables in delphi ?

2019-09-10 13:59发布

Hi I have sql table I want to calculate all the fields to total sum field. enter image description here

标签: sql delphi
2条回答
Fickle 薄情
2楼-- · 2019-09-10 14:26

You can do this in the SELECT statement you use to get the data, something like

SELECT *, big1 + small1 as "TotalSum" from adlar

Obviously, you can add more numeric fields to the fields to sum.

查看更多
神经病院院长
3楼-- · 2019-09-10 14:42

procedure TForm1.Button1Click(Sender: TObject);

begin

ADOQuery1.Close;

ADOQuery1.SQL.Text:='select boyuk1 + kicik1 + qara1 + boyuk2 + kicik2 + boyuk3 * 0,35 as totalsum from adlar2v'; //(table name:adlar2v)

ADOQuery1.Open;

end;

查看更多
登录 后发表回答