![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Sirs, good afternoon. |
|
I'm missing a way to name field in SQL queries. For instance, say I wanted to write SELECT function() AS field GROUP BY field I couldn't do that. I'd have to write SELECT function() AS field GROUP BY function() Is there a way to name this field so that I don't have to write the function call twice? |
#3
| |||
| |||
|
|
Sirs, good afternoon. I'm missing a way to name field in SQL queries. For instance, say I wanted to write SELECT function() AS field GROUP BY field I couldn't do that. I'd have to write SELECT function() AS field GROUP BY function() Is there a way to name this field so that I don't have to write the function call twice? |
#4
| ||||
| ||||
|
|
On Wed, 21 Dec 2011 12:15:24 -0800 (PST), Daniel Bastos wrote: Sirs, good afternoon. I'm missing a way to name field in SQL queries. For instance, say I wanted to write SELECT function() AS field GROUP BY field I couldn't do that. I'd have to write |
|
SELECT function() AS field GROUP BY function() |
|
Is there a way to name this field so that I don't have to write the function call twice? |
|
Essentially, the column just receives the alias (the "AS name") after the GROUP BY gets processed. It's the same reason you couldn't use that alias `field` in a WHERE condition. The WHERE issue has a workaround in the HAVING clause. |
#5
| |||
| |||
|
|
Essentially, the column just receives the alias (the "AS name") after the GROUP BY gets processed. It's the same reason you couldn't use that alias `field` in a WHERE condition. |
![]() |
| Thread Tools | |
| Display Modes | |
| |