Hi SparkOut - Thanks for your reply.
The issue is the query works fine, returns the results expected but I need the query results to include the name of the alias.
In the example query above the result would be three columns of data [x, y, z]. When the result comes back from MySQL I simply output it into a data grid. This again works fine but the columns are called "Col 1, Col 2, Col 3" etc.. I need the column names to be accurate the table column name or the alias.
This part of the application simply allows the user to enter a SQL query into a text box, which is processed and the results are displayed in a data grid. So the code is really simple (which is probably part of the problem):
Code: Select all
--conRes = the connectionID made a few lines previous
--fldSQLin = text box to type query
put fld "fldSQLin" into gSQL
if gSQL is not empty then
put revDataFromQuery( , , conRes, gSQL) into tData
set the dgText of group "dgOutput" to tData
end if
This process works, the question is how can the record set include the alias and column names?
I could, I guess, scan through the query the user enters and collect the alias names before sending the query to MySQL. This would give me the opportunity to the adjust the query to include the names, but, given the simplicity of the code above, the fact that I simply want to parse the query to MySQL to handle; this approach seem Inefficient. The adjusted query would look something like:...
Code: Select all
select 'x', 'y', 'z'
union all
SELECT x, y, concat(x,"_",y) as z FROM MyTable
Confused!
Thanks.