March 9, 2011 at 6:31 am
Aliasing with generic names is generally not best practice, I'll phrase it that way. It's not bad if you can keep track of which table does what, but in this case I mixed up which one was for which year. It would have helped me, and would probably help others reading the code after the fact, if the tables were named something like CurrentYear and PriorYear, or t2010 and t2011.
For extreme examples of when db/table/column names can create confusion, see Phil Factor's Evil Code example.
---------------------------------------------------------
How best to post your question[/url]
How to post performance problems[/url]
Tally Table:What it is and how it replaces a loop[/url]
"stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."
March 9, 2011 at 8:46 am
Thanks everyone, the report is working and I appreciate all your help.
March 10, 2011 at 11:05 am
New blog post that makes this even better: http://sqlblog.com/blogs/john_paul_cook/archive/2011/03/09/when-the-obvious-answer-is-obviously-wrong.aspx
---------------------------------------------------------
How best to post your question[/url]
How to post performance problems[/url]
Tally Table:What it is and how it replaces a loop[/url]
"stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply