Tally table question

  • others will certainly do it differently than I do, but I have three different tables for accomplishing Tally-related objectives:

    Tally, which starts with 1,

    TallyCalendar, which is all date related.

    and Numbers, which starts at 0.

    so if i'm writing something that needs to join to zero, i use the Numbers table (instead of Tally.N -1) just for convenience sake.

    also, for me, the code jumps out a little more; if i join to Numbers, i know it's because of zero.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Lowell (5/11/2012)


    others will certainly do it differently than I do, but I have three different tables for accomplishing Tally-related objectives:

    Tally, which starts with 1,

    TallyCalendar, which is all date related.

    and Numbers, which starts at 0.

    so if i'm writing something that needs to join to zero, i use the Numbers table (instead of Tally.N -1) just for convenience sake.

    also, for me, the code jumps out a little more; if i join to Numbers, i know it's because of zero.

    Well, that certainly covers the bases as far as convenience is concerned, and I like the reasoning behind the usages. Of course, if I were to do that, unless they were fairly small tables I would probably have someone complaining about the duplicate data coverage. (On the other hand, if that was really a concern, I'll bet that making Tally a view based on Numbers would be a simple enough implementation that the query plans for either one would be pretty near identical).

    Thanks for sharing.

    - Les

Viewing 2 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply