Forum Replies Created

Viewing 15 posts - 1,141 through 1,155 (of 1,244 total)

  • RE: CTE (?) or query help

    If neither script is working for you, you may need to post some representative test data... Otherwise we're just stabbing around in the dark.

  • RE: CTE (?) or query help

    I may have simply misunderstood the problem (or my test data set may not be indicative of the actual data set in question) but I didn't get the expected results...

  • RE: Calculate number of groups and group size with multiple criteria

    helal.mobasher 13209 (6/18/2015)


    Thank You. Coupl eissues:

    1. I think there was a missing close parentheses in this statement right before ROWS. I added that.

    \MAX(fgs.rn) OVER (ORDER BY fgs.DT, fgs.BegTime, fgs.ClientID)...

  • RE: Calculate number of groups and group size with multiple criteria

    Here's another solution... I haven't tested it against Dohsan's solution, so I can't tell you which will perform better.

    (This vast majority of the cost on the following is in sorts......

  • RE: A T-sql question.

    ChrisM@Work (6/4/2015)


    Jason A. Long (6/4/2015)


    ChrisM@Work (6/4/2015)


    Jason A. Long (6/4/2015)


    Edit... I didn't like the solution I posted...

    Solution to what? 😀

    It was just a rewrite of the original code Sales.Customer code.

    I didn't...

  • RE: A T-sql question.

    ChrisM@Work (6/4/2015)


    Jason A. Long (6/4/2015)


    Edit... I didn't like the solution I posted...

    Solution to what? 😀

    It was just a rewrite of the original code Sales.Customer code.

    I didn't like it... So I...

  • RE: A T-sql question.

    Edit... I didn't like the solution I posted...

  • RE: Running totals with OVER clause

    TheSQLGuru (6/1/2015)


    Thanks for that Jason!

    No problem. Thanks for kicking me in the back side to get it done... With the data partition and the select output. 😀

    When I want to...

  • RE: Running totals with OVER clause

    As promised... Something a little closer to "real life"... Select outputs rather than updates and a a partition has been added to the data.

    Here is the new(ish) test table...

    /* ================================================================

    Create...

  • RE: Running totals with OVER clause

    TheSQLGuru (5/31/2015)


    Several things:

    1) Main one is that you are putting NULL into the running total column to start. You KNOW you are creating fragementation with page splits. So why didn't...

  • RE: Running totals with OVER clause

    Anyone see any flaws in this version? I think I've got the bases covered, but I'd feel better with a 2nd set of eyes...

    /* ================================================================

    Create a simple 1M test table...

  • RE: Running totals with OVER clause

    Jeff Moden (5/30/2015)


    Ah... be careful now. I don't believe Kevin is talking about "partitioning" as in "table partitioning". I believe that he means that there's some horizontal logic...

  • RE: Running totals with OVER clause

    TheSQLGuru (5/30/2015)


    Jason, I don't think we can call your test apples-to-apples, at least not "real-world" anyway. At least 95% of the real-world running totals cases I have ever seen are...

  • RE: Trying to learn SQL - Advice

    My default answer for that question, for the last few years, has been to start by picking up a copy on "Microsoft SQL Server 2012 T-SQL Fundamentals" by Itzik Ben-Gan.

  • RE: Advanced ranking function

    Thanks Jeff - I appreciate your help. I just wish I knew what I'm doing to trigger the spam detector...

    It doesn't like 2 posts from the same poster, back...

Viewing 15 posts - 1,141 through 1,155 (of 1,244 total)