Skip to main content
Known Participant
December 7, 2006
Question

vertical table to horizontal /eliminate redundant key in a report and show it accross horizontally

  • December 7, 2006
  • 1 reply
  • 195 views
Hello ,
Please take look at my code below.
I am trying to use the group function properly but it is giving me redundant values for the code. Shown horizontally across. I wish to only show it once across and in a ascending order.
For exampleLGOAL
key code
555 100 121 128 188 198 200 And so on also the heading code being code 1 code 2 and so on. 142 141 142



<cfquery name="GET_H"
datasource="#Request.MainDSN#">
SELECT
KEY,
code,

FROM
TAB
ORDER BY
KEY ASC
</cfquery>

<html>
<head>
<title>test</title>
<link rel="stylesheet" href="styles.css">
</head>

<body>

<h1>testing</h1>

<table>
<tr>
<td><b>KEY</b></td>
<td><b>code</b></td>
<!----<td><b>""</b></td>--->

<td> </td>
</tr>
<cfoutput query="GET_H" group="KEY">
<tr>
<td>#KEY#</td>
<cfoutput group="code" ><td>#code#</td></cfoutput> <!----problem code contains redundant values--->
<!----<td>#""#</td>--->


</tr>
</cfoutput>
</table>

</body>
</html>

code shows this below: NOT WHAT I need

key code
664 150 142 240 150 240 150 240 150 240 122 240 132 141 132 142 132 240 122 141 122 141 142 141 142 141
665 132 142 141 132 141 132 142 132 220 141 220 132 131 700 240 220 142 150 220 122 132 122 132 122 132 122 132 122 132
666 132 131 132 500 131 132 150 131 122 500 240 150 132 150 132 210 122 131 122 131 122 131 122 131 122 131 122 131 130 122
668 142 150 700 142 150 210 150 210 141 150 131 142 131 132 141 132 131

This topic has been closed for replies.

1 reply

Participating Frequently
December 7, 2006
Did you try selecting distinct in your query?

SELECT DISTINCT KEY, code,
FROM TAB
ORDER BY KEY, code ASC

Plus, I don't think that you need the group="code" in your nested CFOUTPUT tag.

<table>
<tr>
<td><b>KEY</b></td>
<td><b>code</b></td>
<!----<td><b>""</b></td>--->
<td> </td>
</tr>
<cfoutput query="GET_H" group="KEY">
<tr>
<td>#KEY#</td>
<cfoutput><td>#code#</td></cfoutput>
<!----<td>#""#</td>--->
</tr>
</cfoutput>
</table>

Phil