Header and details query

  • Yes it's possible to do, but it's a little like digging a big hole underneath your car so you can get a flat tyre off and put a fresh tyre back on - instead of using a jack to raise the car.

    Working with header and detail rows (Orders/order lines, invoices/invoice lines etc), typically you generate an output set containing detail rows. All of the detail rows also have the columns holding their header data. The presentation layer - Reporting Services, Excel, Crystal whatever - is used to format this output. All standard stuff, well understood and well documented on the net.

    Are you going to dig the hole, or use the jack?

    “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

  • It will take me app. 15 minutes to create a program, that makes the report - OK

    So, I use the Jack as you descibe it.

    I am in the 'Newbies' section - And trying to understand what i can get from SQL 'Native'

    This was one, which I understand is a 'not'.

    So, thanks!

    Best regards

    Edvard Korsbæk

  • Edvard Korsbæk (9/10/2015)


    It will take me app. 15 minutes to create a program, that makes the report - OK

    So, I use the Jack as you descibe it.

    I am in the 'Newbies' section - And trying to understand what i can get from SQL 'Native'

    This was one, which I understand is a 'not'.

    So, thanks!

    Best regards

    Edvard Korsbæk

    You're welcome, and thanks for the feedback. Post back if you have any uncertainty about how to proceed with this.

    “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

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

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