Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Nested Query Loop

Guest
Sep 13, 2008 Sep 13, 2008
I have a query that I want to loop over the data and display. The query is an inner join with one table being order numbers and the second being details on each order. They are joined by the order number. What i am trying to do is loop over the data and group all the details under the order number. I have tried numerous nesting configurations and I have had no luck. This is what I would like to see.

Order Number 1
Item 1
Item 2
Item 3

Order Number 2
Item 1
Item 2

Order Number 3
item 1
Item 2
Item 3
Item 4

Any recomendations?


721
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Sep 14, 2008 Sep 14, 2008
Thanks guys! I had been trying that approach but apparently I was doing something wrong before. I had been getting nesting cfoutput errors and then I was lost in a formatting mess. Thanks again for the direction.
Translate
LEGEND ,
Sep 13, 2008 Sep 13, 2008
<cfoutput> tag has a GROUP attribute - check it out.
the doc are available online if you do not have them.

hth

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Sep 13, 2008 Sep 13, 2008
You could use the "group" attribute of cfoutput. In your sql query, sort the results by the [OrderNumber] column. Then group by [OrderNumber] in your output.

<cfoutput query="yourQuery" group="OrderNumber">
<!---- each order number will be displayed only once --->
#OrderNumber#<br>

<cfoutput>
#ItemNumber#
<cfoutput>
</cfoutput>

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_m-o_16.html
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 14, 2008 Sep 14, 2008
LATEST
Thanks guys! I had been trying that approach but apparently I was doing something wrong before. I had been getting nesting cfoutput errors and then I was lost in a formatting mess. Thanks again for the direction.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources