I have 3 execute SQL statements in a loop that I am using to pull data from table SummaryData. The data is then placed in an array that I am pulling into a C3 chart. I need to sort the SummaryData table by Type, then by Year before I extract the data, I'm assuming I need to sort the data within the execute SQL statements not in the script itself. I've tried using the ORDER BY statement but have not had any luck. Below is one of the 3 execute SQL statements I am using. Everything works fine except for the sorting.
Let ([ _Data = _FIELDREF_getField ( SummaryData::Year ; True ); _Type = _FIELDREF_getField ( SummaryData::Type ; True ); _Year = _FIELDREF_getField ( SummaryData::Year ; True ); _Table = _FIELDREF_getTO ( SummaryData::ID ; True ); _Query = "SELECT " & _Data & " FROM " & _Table &" WHERE " & _Year & " = ? AND " & _Type & " = ?" ];