hola chicos miren aqui con una duda, estaba creando unas consultas para mi programa, basicamente son sumatorias de las tablas, pero al crear la sumatoria de mi tercer tabla me da el siguient error
error de sintaxis falta operador en sum(imp)
el codigo es el siguiente:
Código Delphi
[-]
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select sum(ganancia) from diario');
adoquery1.SQL.Add('where fecha between :Fechain and :Fechafin');
adoquery1.Parameters.ParamByName('Fechain').Value:=datetimepicker1.DateTime;
adoquery1.Parameters.ParamByName('Fechafin').Value:=datetimepicker2.DateTime;
adoquery1.Open;
a:=adoquery1.Fields[0].AsFloat;
adoquery1.Close;
edit1.Text:=floattostr(a);
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select sum(capital) from diario');
adoquery1.SQL.Add('where fecha between :Fechain and :Fechafin');
adoquery1.Parameters.ParamByName('Fechain').Value:=datetimepicker1.DateTime;
adoquery1.Parameters.ParamByName('Fechafin').Value:=datetimepicker2.DateTime;
adoquery1.Open;
b:=adoquery1.Fields[0].AsFloat;
adoquery1.Close;
edit2.Text:=floattostr(b);
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select sum(imp) from diario');
adoquery1.SQL.Add('where fecha between :Fechain and :Fechafin');
adoquery1.Parameters.ParamByName('Fechain').Value:=datetimepicker1.DateTime;
adoquery1.Parameters.ParamByName('Fechafin').Value:=datetimepicker2.DateTime;
adoquery1.Open;
c:=adoquery1.Fields[0].AsFloat;
adoquery1.Close;
edit3.Text:=floattostr(c);