I have tried the following, but it throws an error:
$grid->SelectCommand = '
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.