Forum Replies Created

Viewing 15 posts - 57,376 through 57,390 (of 59,049 total)

  • RE: Grouping total sales by payment type

    No.  Serqiy is correct... the table design is wrong... if you take multiple payments for a given invoice, you should have multiple rows.

  • RE: Grouping total sales by payment type

    Stephen,

    If you want separate totals for each payment type, then this would do...

     SELECT SUM(Cash)    AS TotalCash,

            SUM(Cheque)  AS TotalCheque,

            SUM(CC)      AS TotalCC,

            SUM(Account) AS TotalAccount

            SUM(Total)   AS GrandTotal

           ...

  • RE: quantize ?

    quoteActually, none of them is absolutely right.

    If you have one that is, would you mind sharing it...

  • RE: quantize ?

    Thanks for the feedback, Mark...  this one was a lot of fun!

    Serqiy... I'd still like to know the "magic" behind your 5 second report, if you get a chance.

  • RE: Grouping total sales by payment type

    Should the totals be by day for the range or are you just looking for a grand total for the range?

  • RE: quantize ?

    Thanks for the benchmark, Serqiy... the computed columns help a lot especially when you make them both deterministic so they can be indexed... got it down to 7 seconds on 4...

  • RE: quantize ?

    Mark,

    I don't know if I can get it to be a fast as Serqiy says he can, but I did get it down to 8 seconds...

    First, add this index...

    October 14, 2006 at 12:27 am

    #665884

  • RE: quantize ?

    Serqiy, my old friend... I'm all ears... there's code in the post to gen a million rows... can you show us how to get a similar report as the cross...

  • RE: quantize ?

    Thanks Mark,

    I finally have enough information to help... with great zeal, I may add...

    First, as Serqiy suggested, you don't need all those "generated" columns.  He suggested keeping one of them...

  • RE: is the sql server being smart or stupid?

    Of course there's some education in it, Ken... but, it's still forbidden because it hurts performance and a derived table should be used instead.  And, it will also catch these...

  • RE: is the sql server being smart or stupid?

    Crud... I didn't read the second query... sorry... not enough coffee...

    To play on what David suggested... it's one of the reasons why I'm glad that the standards I wrote for...

  • RE: Generic Audit Trigger

    It's because the Inserted table is only available in the current session... the dynamic SQL is actually a separate session with a different scope.  That's the whole reason why we...

  • RE: is the sql server being smart or stupid?

    That's strange... I'm thinking we have a service pack problem here... I'll bet you guys are running SP4 on SQL Server 2000... I'm running SP3A... and here's what I get...

  • RE: quantize ?

    Mark,

    Thanks for posting the table schema...

    Sorry to plague you with questions but trying to do this in a very simple fashion... I see that the TimeGenerated column is a DateTime...

  • RE: Generic Audit Trigger

    I'm just about out of tricks on the Text columns, Charlotte... I'm still playing with it but haven't been able to come up with anything, yet.

Viewing 15 posts - 57,376 through 57,390 (of 59,049 total)