We use Delphi XE6 the component with error is a TFDQuery in MySQL 4.1.
When I try to open the Query using a group the FDQuery show:
type mismatch expecting AutoInc actual LongWord
In the Field Editor the field is correct,it shows AutoInc
but the error always appears, if I remove the group by
on query the error stop but the results is wrong and when I remove all fields of Field Editor and try again, work correctly.
I tried to insert a field manually on Field Editor as an Integer
field, but it didn't work either.
The field with error (NUMBOLE
) in my table is an Integer
field, AutoInc
(primary key from tabbolvenda)
FDQuery1.Close;
FDQuery1.SQL.Clear;
FDQuery1.SQL.Add('select');
FDQuery1.SQL.Add('b.NUMVENDA,');
FDQuery1.SQL.Add('a.DATAVENDA,');
FDQuery1.SQL.Add('b.NUMBOLE,');
FDQuery1.SQL.Add('b.PARCELAS,');
FDQuery1.SQL.Add('a.CODCLIENTE,');
FDQuery1.SQL.Add('a.NOMECLIENTE,');
FDQuery1.SQL.Add('b.DATAVTO,');
FDQuery1.SQL.Add('a.MONTANTE,');
FDQuery1.SQL.Add('b.DATAPTO,');
FDQuery1.SQL.Add('if(b.EMABERTO = ''True'', ''Sim'',''Não'') as EMABERTO,');
FDQuery1.SQL.Add('a.CUSTOVENDA,');
FDQuery1.SQL.Add('a.LUCROVENDA,');
FDQuery1.SQL.Add('a.COMISSAO');
FDQuery1.SQL.Add('from tabvendas a inner join tabbolvenda b');
FDQuery1.SQL.Add('on a.NUMVENDA = b.NUMVENDA');
FDQuery1.SQL.Add('group by b.NUMVENDA order by b.NUMVENDA'); <--- if I remove this group by it works
FDQuery1.Open;
Is there any property on FDQuery that it makes this error disappear? When my project use to be on Delphi 6 with Zeos Query, the same select
doesn't show any error message. It happens only on FDQuery.