?
Solved

Nesting cfloop queries

Posted on 2014-03-17
3
Medium Priority
?
262 Views
Last Modified: 2014-03-18
Hello.

I need to do the following:

I have  MyTable structured like this.

ID      NumImages
a          3
b          6
c          4

I want to output each ID as many times as there is NumImages.recordcount ,output it as a1,a2,a3  then output the next ID NumImages.recordcount as b1,b2,b3...



Trying to achieve this result:

a1
a2
a3

b1
b2
b3
b4
b5
b6

c1
c2
c3
c4

I have tried all kings of nesting cfoutputs, cfloops, cfoutput loops..I just don't get it.
Hope this makes sense.
Can you help?
0
Comment
Question by:izweig
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 2000 total points
ID: 39936140
Do a regular query loop, then within it loop from=1 to=#NumImages#

<cfoutput query="yourQuery">
      <cfloop from="1" to="#NumImages#" index="counter">
           #yourQuery.id##counter#<br/>
      </cfloop>
      <!--- extra break between id's --->
      <br/>
</cfoutput>
0
 

Author Closing Comment

by:izweig
ID: 39936751
Awesome thanks.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 39936847
Welcome.
0

Featured Post

Certified OpenStack Administrator Course

We just refreshed our COA course based on the Newton exam.  With 14 labs, this course goes over the different OpenStack services that are part of the certification: Dashboard, Identity Service, Image Service, Networking, Compute, Object Storage, Block Storage, and Orchestration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating and Managing Databases with phpMyAdmin in cPanel.
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question