I have tried the following, but it throws an error:
SET @var1 := a long SQL statement;
SELECT @var1 AS mycolumn
Is there a way to set variables in SQL and use them in SelectCommand?
I can solve this in two ways:
1. in PHP by assigning the SQL result to a php variable and then using it in the SelectCommand,
2. putting everything in SelectCommand, by writing a huge statement, that is hard to read and debug
I was wondering if there was a more elegant solution, like defining a SQL variable and using that variable in SelectCommand.
This topic was modified 4 months, 1 week ago by bogdanm.
I’m thinking there is a third option:
3. Instead of assigning a long statement to a variable in SQL, use those statements as the first SELECT elements and then reference them in the same SELECT. Those columns can be set as hidden and not editable.
I’m wondering which would be better from a performance point of view. The first solution would require PHP to query the SQL, which has some overhead. The third would have jqGrid handle the extra columns to be hidden.