I'm working on an app that needs to create statistics from differing sets of columns in a table. In my code, I drop the existing STATS table then create new version with the desired columns. There are 10 different sets of stats that need to be calculated from two different tables (which is set in TMPtable string) and between 5 and 12 columns (in SQLselect string).
Code: Select all
DBM.LiteSQL1.SQL.Clear;
DBM.LiteSQL1.SQL.Add('DROP TABLE IF EXISTS '+TMPtable+'STATS');
DBM.LiteSQL1.Execute;
DBM.LiteSQL1.SQL.Clear;
DBM.LiteSQL1.SQL.Add('CREATE TABLE '+TMPtable+'STATS AS ' + SQLselect);
DBM.LiteSQL1.SQL.Add(' WHERE '+SQLwhere);
DBM.LiteSQL1.Execute;
I've tried opening and closing, changing active state, and ApplyUpdates but problem still exists. I'm sure I'm missing something obvious but just not seeing the solution so any insights would be appreciated