is it possible to alias an aggregate function in a select clause as AliasTable.AliasColumn? The reason is because I want minimum modifications in my arrays (I’m using PHP). Thanks!
P.S.
I’m using SQl Server 2008
P.S.#2
Example:
SELECT MAX(Person.name) name, MAX(Person.address) address, Farm.id,
FROM Farm
LEFT JOIN Person on Person.farm_id = Farm.id
GROUP BY Person.name
could I alias name as Person.name and address as Person.address (it doesn’t have to be “Person”)
You can create an SQL View containing the select statement with the aggregate function as an alias. That way, you won’t have any problems with it in your PHP code, because you can use the SQL View as a table.
Sample SQL statement for creating the view:
Sample SQL statement for using the view: