Hi Dave (and everyone else),

I've got the grouping and ordering down, it's the formatting of the
output that's the challenge. The trick is to get my HTML table only 3
cols wide and then only have the first 3 results of the query on the
Subcategory table displayed under the appropriate Category heading.

I have a straight HTML version on the index of my site to illustrate
where I am trying to go with this. It's at http://www.guymcdowell.com 

TIA,



Truly,

Guy J. McDowell, M.M.C.P.
(705) 324-9144 ex 3422
[EMAIL PROTECTED]
~~~~~~~~~~~~~~~~~~~~
Sir Sandford Fleming College
Frost Campus
P.O. Box 8000
Lindsay, Ontario
K9V 5E6


>>> [EMAIL PROTECTED] 02/21/03 10:33am >>>
>This is a borderline newbie question. Perhaps we should have a
>CF-Brainfart list. Anyway....
>
>Challenge: To have out put from two tables put into a three column
>wide, n-rows deep HTML table a la Yahoo! Each column's formatted
output
>would look something like this:
>
>Category Name
>
>Subcategory Name 1, Subcategory Name 2, Subcategory Name 3, more...
>
>Given: CF 5, MS Access 2000, tblCategory, tblSubcategory, one rusty 
CF
>developer.
>
>I'm pretty sure this is a job for query-a-query and loop list while
>n<=3 type logic, but I just can't get it to jive. Help?

Nah. Look into the "group" attribute of the <cfoutput query...> tag.
Just 
group your query results by the category name and you should be good to
go. 
The key is the ORDER BY clause in your SQL statement. You want to make
sure 
you order by the category name so that CF can properly group the data.

Here's a brief sample:

<cfquery name="queryName" datasource="myDSN">
SELECT c.categoryName,
s.subcategory
FROM tblCategory c, tblSubcategory s
WHERE c.categoryid = s.categoryid
ORDER BY c.categoryName
</cfquery>

Then in your output, you'd do something like:

<cfoutput query="queryName" group="categoryid">
  #queryName.categoryName#<br/>
  <cfoutput>#queryName.subcategory#</cfoutput>
</cfoutput>

The nested <cfoutput> is necessary because you need to "tell" CF which

fields to group.

Something like that should take care of your issue. Haven't tested that

code, but it looks Kosher.

Regards,
Dave.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to