I am getting this syntax error message:
[FireDAC][Phys][SQLite] ERROR: near "ON": syntax ERROR
On my code here:
qryItems.Active := False;
qryItems.ResourceOptions.ParamCreate := False;
qryItems.SQL.Text := 'SELECT category.name, item.name, item.description' +
'FROM item ' +
'JOIN category ON item.category_id = category.list_id' +
'WHERE item.name = :searches OR :searches IS NULL' +
'ORDER BY category.name LIMIT 5';
qryItems.ParamByName('searches').AsString := Format('%%%s%%',[edtSearch.Text]);
qryItems.Active := True;
qryItems.SQL.Clear;
qryItems.ExecSQL;
I tried running the code in Query Editor of TFDQuery with no issues. I am compelled to slice the query to avoid long text violations with this syntax '+' — I hope this is still the practice.
It looks like nothing is wrong with my syntax. Otherwise, I miss something here.
qryItems.SQL.Textat runtime and you will see the missing spaces. - Val Marinovitem_descriptionandFROMin the first two lines, betweencategory.list_idandWHEREon the next line, and betweenNULLandORDERon the next two lines. Uwe's answer below identifies those three errors perfectly, too. Try again. - Ken White