Any help here would be great.
I am trying to use the parameters to dynamically change "ORDER BY"
Below is the code I tried, but despite the following documentation, I still get the error message "[FIREDAC] [PHYS] [MYSQL] You have an error in the SQL syntax ... next to" ORDER BY some_field "in line 4
I set ParamCreate to True
My MySQL database
FDQuery1.Close;
FDQuery1.SQL.Clear;
FDQuery1.SQL.Add('SELECT *');
FDQuery1.SQL.Add('FROM my_table');
FDQuery1.SQL.Add('LIMIT 1000');
FDQuery1.SQL.Add(':id');
FDQuery1.ParamByName('id').AsString := 'ORDER BY some_field';
FDQuery1.Open;
source
share