Turning table to crosstable

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Turning table to crosstable

    Hello,

    I would like to have advice...
    I have a record set (cfquery) that return me something like:
    3;5;3;0,0180889615127196
    3;10;7;0,0422075768630123
    3;15;13;0,0783854998884514
    3;20;8;0,0482372307005855
    3;25;3;0,0180889615127196
    3;30;2;0,0120593076751464
    3;35;2;0,0120593076751464
    11;0;2;0,00253791969260717
    11;5;37;0,0469515143132326
    11;10;290;0,367998355428039
    11;15;214;0,271557407108967
    11;20;80;0,101516787704287
    11;25;49;0,0621790324688756
    11;30;27;0,0342619158501968
    11;35;23;0,0291860764649824
    11;40;18;0,0228412772334645
    11;45;9;0,0114206386167323
    11;50;1;0,00126895984630358
    11;55;3;0,00380687953891075
    11;65;1;0,00126895984630358

    I would like to turn this result in a crosstab way
    In column the 1st value, in line the 2nd value and the 3rd/4th value in the
    cross of the 2 first...

    Did any of you have already do this kind of stuff?

    I am working on this but help will be great :)

    maquejp Guest

  2. Similar Questions and Discussions

    1. Turning off audio?
      Is there any way to turn off the audio on a game? I was playing around with the game at http://www.bubblebox.com/game/adventure/91.htm , and I'd...
    2. Turning a file into an ad
      Hi there I really need some beginner help. I need to turn this file http://www.thefightmusic.com/f/header3.swf Into a 468*60 banner ad. Basically...
    3. THOSE OTF FONTS: TURNING 'EM OFF
      OS 10.2.8 / dual 1-gHz / Illustrator CS: I normally use Suitcase (X1) to manage my fonts. I remove all extraneous fonts and keep them in a central...
    4. Could not load type VTFixup Table from assembly Invalid token in v-table fix-up table.
      We are getting this error after clearing the web.config of database infomation - even after using the wizard to re-enter the information. I could...
    5. Turning string into a table
      Is there a way to make for example: // (Column info) // String 1: ] ] // (Row)
  3. #2

    Default Re: Turning table to crosstable

    The question is not clear.
    Given the posted record set, what exactly do you want displayed/returned?
    Also, what DB are you using?
    MikerRoo Guest

  4. #3

    Default Re: Turning table to crosstable

    Here is one of millions of articles on cross-tab queries:
    [url]http://www.databasejournal.com/features/mssql/article.php/10894_3516331_2[/url]
    MikerRoo Guest

  5. #4

    Default Re: Turning table to crosstable

    Well, it should look as:
    | 3 | 11
    ------------------------
    0 | - | 2
    5 | 3 | 37
    10 | 7 | 290
    15 | 13 | 214
    20 | 8 | 80
    ...

    I have find "a solution" using queries of query; I have not the code to show
    you here (at work) as I work on this at home.

    But the main query should look:
    Q1 = select fld1, fld2, sum(fld3), fld4 from thetable group by fld1, fld2

    I do 2 qOq
    Q2 = select distinct fld1col from Q1
    Q3 = select distinct fld2 row from Q1

    And finally, I:

    loop q2
    loop q3
    query Q1 = select fld3 from Q1 where fld1=col and fld2 = row

    My problem is that the dabases is only about 50000 records for the moment, but
    will grow with the time (+at leat 50000 each year) and I thing that this will
    be slow...

    Database: Oracle 9i

    maquejp Guest

  6. #5

    Default Re: Turning table to crosstable

    Thank you! I will take a look to the link you provide to me...

    I work with Oracle Database, but I am not familiar witth the concept of cube...
    maquejp Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139