I have the following DQL (Doctrine1.2):
$dql->select('sum(t.column1) column1, t.column2') ->from('Table t') ->groupBy('t.column2') ->orderBy('column1');
But the generated SQL is the same as for the following DQL:
$dql->select('sum(t.column1) column1, t.column2') ->from('Table t') ->groupBy('t.column2') ->orderBy('t.column1');
Is it possible to force Doctrine to use the alias column1 instead of the column name t.column1 ?
I need this because I would like to have the same output format from the model for two very similar DQLs. (the same template has been displayed recently). Another DQL is as follows:
$dql->select('t.column1, t.column2') ->from('Table t') ->orderBy('t.column1');
A possible workaround is to select sum(t.column1) twice. First with the alias column1 and the second time with some other alias, why after passwd to the orderBy function, but this does not seem to be the clearest solution.
Any suggestions?
thanks
source share