Thanks Much!  Can't believe how convoluted my solution was.

-----Original Message-----
From: John D. Burns [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 20, 2003 9:27 AM
To: CF-Talk
Subject: Re: This works but how should something like this be done?

Do a query ordering everything by Category, then by link.  Then in the
output, group by the category field...

<cfquery name="getLinks">
...
</cfquery>

<cfoutput query="getLinks" group="Category Value">
#category value#
<cfoutput>
  <a href=""> </cfoutput>
</cfoutput>

----- Original Message -----
From: John Munyan <[EMAIL PROTECTED]>
Date: Thursday, November 20, 2003 12:17 pm
Subject: This works but how should something like this be done?

> I have this table that contains links that are put into 1 of about 10
> categories.  
>
>
>
> The table structure is as follows:
>
>
>
> Auto-number (Identity Column) | Category Value | HttpLink |
> DisplayValuefor Link| UserID | DateTime | Available
>
>
>
> The output I was looking for and got is:
>
>
>
> Category1
>
>            Link1
>
>            Link2
>
>            Link3
>
> Category2
>
>            Link1
>
>            Link2
>
> CategoryN
>
>            Link1
>
>            Link2  
>
>
>
> How I got this is very suspect.  Not really looking to take up
> anyone'stime with specific code about how this should be done
> necessarily but
> wondering how should this be structured?  I don't know if that makes
> sense.  I just can't believe this is write though it is how my
> mind saw
> it. :-)  I can't see how to otherwise group the links by category
> unlessI created one query per each category---which is essentially
> what I did.
> How whack is this?
>
>
>
> Thanks,
>
>
>
> John  
>
>
>
> <cfquery name="Getlinkcatergory" datasource="hike">
>
>            SELECT * from globallinkcatergory
>
> </cfquery>
>
>
>
> <!--- The above gets the categories --->
>
>
>
>                        <cfloop from="1"
> to="#getlinkcatergory.recordcount#" index="i">
>
>                                    <cfquery name="GetLinks"
> datasource="hike">
>
>                                                SELECT * from
> globallinks
>
>                                                where
> catergoryheading =
> '<cfoutput>#getlinkcatergory.linkcatergory[i]#</cfoutput>'
>
>                                                order by
> displayvalue
>
>                                    </cfquery>
>
>
> <strong><cfoutput>#getlinkcatergory.linkcatergory[i]
#</cfoutput>:</stron
> g>
>
>                                                <p></p>
>
>                                                <cfoutput
> query="GetLinks">
>
>                                                            <table
> width="100%" border="0" cellpadding="2" cellspacing="0">
>
>                        <tr bgcolor="###iif(currentrow MOD
> 2,DE('ffffff'),DE('efefef'))#">
>
>
> <td>#GetLinks.DisplayValue#</td>
>
>
> </tr>
>
>                                                            </table>
>
>                                                </cfoutput>
>
>                                                <hr width="100%">
>
>                        </cfloop>
>
>
>

________________________________


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to