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

QofQ and Nesting

Guest
Jul 10, 2007 Jul 10, 2007

Copy link to clipboard

Copied

I'm using a QofQ in order to find subcategories from my database. The database is made up as follows;

ID, categoryname, subcategoryof

Same sample data would be as follows;

1, Category1,(null)
2, Subcategory, 1

The intended result is to have the following output;

Category1
- Subcategory

This will be presented in a select box as part of a form.

However, what I'm getting at the moment is the following;

Subcategory
Category1
Subcategory
Category1
Subcategory
Category1

(the same ones repeated 3 times, in that order and without the '-' before the subcategories).

The code I have at the moment is as follows (and yes, I have no doubt this isn't the most elegant method to use!);

TOPICS
Advanced techniques

Views

237

Translate

Translate

Report

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
Jul 10, 2007 Jul 10, 2007
I have figured it out - I had an unnecessary cfoutput and my subcategory query was doing a query against the wrong result set.

Votes

Translate

Translate
Guest
Jul 10, 2007 Jul 10, 2007

Copy link to clipboard

Copied

I have figured it out - I had an unnecessary cfoutput and my subcategory query was doing a query against the wrong result set.

Votes

Translate

Translate

Report

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
LEGEND ,
Jul 10, 2007 Jul 10, 2007

Copy link to clipboard

Copied

LATEST
First, use a self join in your query

Next use the group attribute of the cfquery tag on the parent category.

Votes

Translate

Translate

Report

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
Documentation