Adding Columns on the Fly

  • I have a report that looks like the following

    NameCity Client NoAccount No Balance

    SmithSydney 1234561258792 3.95

    JonesMelbourne 2589641000657 9.54

    BrownPerth 9876541000879 5.46

    BrownPerth 9876541000880 7.51

    WhiteSydney 6548521007562 10.65

    HOWEVER I need it to look like the following:

    NameCity Client NoAccount No BalanceAccount No Balance

    SmithSydney 1234561258792 3.95

    JonesMelbourne 2589641000657 9.54

    BrownPerth 9876541000879 5.461000880 7.51

    WhiteSydney 6548521007562 10.65

    The rquirement is that if the Client No is the same that the Account No and Balance appear on the same row but just additional columns. There is no restriction on how many extrac columns there would be.

    Any suggestions on how I do this or links to places on the web that may be able to help me.

    Once the query is working it needs to go into Visual Studio so that the report can be set up as a subscription.

    😀

    Thanking you in advance.

  • its look like a cross tab report to me, you can do it with 2 ways

    1) create a cross tab report, doing so you can have 'N' number of columns.

    2) you can use Pivot, it have to be dynamic, because i sense that you can have N number of columns to be added, as a single client have many account, but if there is a limit like 10 columns then you can use it the plain Pivot query.

    Following are the article by Jeff Moden, you can look into these.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns[/url]

    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url]

    hope it helps

Viewing 2 posts - 1 through 1 (of 1 total)

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