Bug #2467 | Use of an alias in a 'group by function'? | ||
---|---|---|---|
Submitted: | 21 Jan 2004 1:56 | Modified: | 7 Nov 2005 18:14 |
Reporter: | Sébastien Vanvelthem | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | MySQL Server | Severity: | S4 (Feature request) |
Version: | 4.0.17 | OS: | Any (All) |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[21 Jan 2004 1:56]
Sébastien Vanvelthem
[27 Jan 2004 6:52]
Thomas Mayer
Have you ever tried something like this: group by 1 order by 1,2 This could avoid your overhead in calculation.
[29 Jan 2004 3:02]
Sébastien Vanvelthem
That's not a problem with sorting... An conceptual example is : select (table.quantity * table.price) as total, (table.quantity * table.price / table.some_value) as total_adapted from table Why can we do select (table.quantity * table.price) as total, (total / table.some_value) as total_adapted from table instead? whithout recalculating (table.quantity * table.price) Hope it helps to make things clearer Thanks
[7 Oct 2005 18:14]
Hartmut Holzgraefe
this looks like a job for subqueries? SELECT t1.total, , t1.total / t1.some_value FROM (SELECT *, (table.quantity * table.price) as total FROM table) AS t1
[8 Nov 2005 0:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".