Merging/Folding Records

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Merging/Folding Records

    I have a MS Access table with three columns, DATE, CLASS, LESSON

    01/01/2006 CLASS1 Fishing
    01/01/2006 CLASS2 Baking
    01/01/2006 CLASS3 Movies
    02/01/2006 CLASS1 Movies
    02/01/2006 CLASS2 Hunting
    03/01/2006 CLASS1 Weeding
    03/01/2006 CLASS2 Pruning
    03/01/2006 CLASS 3 Typing

    I would like to code a query that will help me generate a output that
    has a table with the data, and the class1, class2, and class3
    descriptions. Something like

    Date CLASS1 CLASS2 CLASS3
    01/01/2006 FISHING Baking Movies
    02/01/2006 Movies Hunting
    03/01/2006 Weeding Pruning Typing

    Sometimes there won't be a class entry for some days.

    Any suggestions on how to buld the table?

    Dennis Guest

  2. Similar Questions and Discussions

    1. Code folding extension for Dreamweaver?
      Hello, does anybody knows a code folding extension for Dreamweaver DW CS4? OK you can select some line and fold them but this is not a big help...
    2. Refactoring Browsers (was: [ann] AEditor 0.10, folding added)
      On Wed, 2003-08-13 at 14:03, Lothar Scholz wrote: This is an interesting assertion considering that the original refactoring browser was...
    3. AW: [ann] AEditor 0.10, folding added
      No replies ? they dont mean to ignore your post intentionally, but you know, there is a really good editor distributed with ruby. SciTe....
    4. [ann] AEditor 0.10, folding added
      On Fri, 08 Aug 2003 19:49:51 +0200, Simon Strandgaard wrote: No replies ? Many people has downloaded AEditor, but only few has...
    5. Folding Tree Menu...any help?
      As far as I know, it can only be done with javascript, unless you want to use Java or Flash, but those both suck. I believe there are a few...
  3. #2

    Default Re: Merging/Folding Records

    I figured it out using a PIVOT and TRANSFORM to get what I need.
    Unfortunately some of the column names that get generated have spaces
    in them. Any thoughts as how to get rid of that? I don't think I can
    use the "AS" in my select as those fields aren't there until the PIVOT
    is done.

    <cfquery name="Get_Events" Datasource="Calendar">
    TRANSFORM min(calendar.lesson) as minlesson
    SELECT StartDate
    FROM Calendar
    WHERE (StartDate BETWEEN #CreateODBCDate(startrange)# AND
    #CreateODBCDate(endrange)#)
    group by calendar.StartDate
    PIVOT calendar.class;
    </cfquery>

    Dennis 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