Query to find "games behind" in a sports table

  • aaron.reese (11/14/2014)


    ...VARCHAR / NVARCHAR - who cares on a small adatabase that is only ever going to be used with Latin CP1 collation unless the number of records is going to be in the tens of millions. ...

    Using the correct datatype is important for other reasons too. Think implicit conversions and sargability.

    โ€œWrite the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.โ€ - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • CELKO (11/14/2014)


    When you're a carpenter making a beautiful chest of drawers, you're not going to use a piece of plywood on the back, even though it faces the wall and nobody will ever see it. You'll know it's there, so you're going to use a beautiful piece of wood on the back.

    -- Steve Jobs

    I took a weekend away from SQL and stained the carved, solid teak front doors on my new house. This is precisely the reason I stained both sides (inside and outside). Because Steve Jobs told me to. ๐Ÿ˜€


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

  • yes, but if you inherited a cupboard with a plywood back, you wouldn't replace it with a solid wood one, especially not if the front was made from MDF.

    Sometimes you have to work with what you are given

Viewing 3 posts - 16 through 17 (of 17 total)

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