Add an "order by studioid".  Anytime you do a group by in a cfoutput tag,
you must order by the same column in the query. I always thought that the
attribute should be order by - as it is, it's kinda confusing.

Depending on the many-to-one relationships here, you might need several
order bys and several group bys.  You can nest additional cfoutputs, if
necessary, each with a group attribute, except for the innermost.

Chuck McElwee
etech solutions inc
www.etechsolutions.com


-----Original Message-----
From: Paul Ihrig [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 06, 2002 5:27 PM
To: CF-Talk
Subject: Group in cfoutput query. brain fart


sorry for the long email

my problem is that if an employee has more then 1 phone number
the whole record of that employee is displayed twice

i would like to have it just loop over the multiple phone numbers, of that
employee
& display them along side there name.

i have tried writing several different quires that call the top query
several different groupings, but i just cant nail it.

any advice or ideas would be great

thank you
-paul

[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[

<cfquery name="Employees" datasource="RPH">
SELECT tblEmployee.FirstName, tblEmployee.LastName, tblEmployee.EmployeeID,
tblEmployee.StudioID, tblEmployee.Status, tblStudio.StudioID,
tblStudio.OfficeID, tblStudio.StudioName, tblOffice.OfficeID,
tblOffice.City, tblPhone.PhoneNumb, tblFloor.floor
FROM tblEmployee, tblStudio, tblOffice, tblPhone, tblFloor
WHERE tblEmployee.studioid = tblStudio.studioid
AND tblOffice.OfficeID = '#FORM.OfficeID#'
AND tblPhone.EmpResID = tblEmployee.EMPLOYEE_ID
AND tblEmployee.studioid in (#FORM.StudioID#)
AND tblEmployee.floorid = tblFloor.floorid
</cfquery>

<table>
<tr valign="top" align="center">
<td><b>Name</b></td>
<td><b>Extension</b></td>
<td colspan="3"><b>Edit</b></td>
</tr>

<CFOUTPUT QUERY="Employees" GROUP="StudioName">

<tr>
<td colspan="2">Office - Studio</td>
<td colspan="3">#Employees.City# - #Employees.StudioName#</td>
</tr>

<cfoutput>
<tr>
<td><B>#Employees.LastName#</B>, #Employees.FirstName#</td>
<td>#Employees.PhoneNumb#</td>

<td>Edit</td>

<td>Photo</td>

<form action="Emp_Delete.cfm" method="post" name="D_Emp">
<td>
<INPUT TYPE="checkbox" NAME="Status" VALUE="Yes" <cfif (#
LSNumberFormat(Employees.Status) # EQ 1)>CHECKED</cfif>>
<input type="hidden" name="EmployeeID" value="#Employees.EmployeeID#">
<cfif #Employees.Status# EQ 0>
<input type="submit" value="check to hide user">
<cfelse>
<input type="submit" value="un-check to show user"></cfif>
</td></form>

</tr>
</cfoutput>
</cfoutput>

______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
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