CrossTab Query-URGENT PLEASE!

  • Sure thing, CA... thanks for asking...

    http://www.sqlservercentral.com/articles/Advanced+Querying/61716/

    ... and thanks for the kudo on formatting. I do it mostly so I can read it 😀

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Hello Again,

    How can I prevent duplicate values on a row without using Primary keys?

    For example you can easily see that Sales price2 and sales price3 are same.How can I prevent this?

  • erdem (2/28/2008)


    Hello Again,

    How can I prevent duplicate values on a row without using Primary keys?

    For example you can easily see that Sales price2 and sales price3 are same.How can I prevent this?

    Prevent the duplicate values where? In the report or in the original table?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • This topic seems very much alike this one

    http://www.sqlservercentral.com/Forums/Topic475244-8-1.aspx


    N 56°04'39.16"
    E 12°55'05.25"

  • Ian Yates (2/17/2008)


    And I would get your reporting tool to do the cross-tab rather than trying to bend a SQL resultset to do it. For example, both Crystal Reports and SQL Server Reporting Services can easily do cross-tabs or matrices.

    A cross-tab is a display/presentation method. Use SQL to return data and then let your display package format it.

    I agree, these tools will do the job more effectively than writing it in SQL. Besides what happens when you find you need to change the query? Consider what you are trying to accomplish and accomplish it with the proper tool.

Viewing 5 posts - 16 through 21 (of 21 total)

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