Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Most RDBMSes won't let you use a column alias in the same scope as it is defined (pretty sure the SQL standard itself doesn't specify that it should be allowed). You can get around this by using a CTE.

Also, optimisers aren't stupid, the actual sum() function will not be recalculated.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: