Toniq :
Is this a bad practice having alias same as column name? It seems to work but I wonder will it lead to problems ?
SELECT SUM(foo) AS foo FROM {$table}
drakin8564 :
It shouldn't cause any problems. That said it would probably read better(more easily understandable) if you name it something like totalfoo or sum_of_foo.