I have a database with three tables:
Departments
ID
Name

Managers
ID
Name
DeptID

Workers
ID
Name
ManagerID

I'm creating a report that looks like this:

Dept 1
        Manager1
                Worker1
                Worker2
                Worker3 
        Manager2
                Worker4
                Worker5
Dept2
        Manager3
                Worker6
                Worker7

Etc.

The first time I did this report, I did a query loop through departments, 
with a nested loop through managers, and finally a nested loop throuh 
workers.  But this was three queries, which seemed inefficient.

So then I created a single query, but it kept repeating the dept or manager 
name for each worker, so I instead did this (pseudocode):

begin dept loop
        if deptname NEQ olddeptname
                display deptname
        else
                if managername NEQ old managername
                        display managername
                else
                        display workername
                endif
        endif
end loop

I'm not sure if this is the right approach either.  Is there a way either 
in SQL or Coldfusion to have it only show the department and and manager 
the first time the value appears?

T

______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to