http://ttcfm.open.ac.uk/~bs3578/test1/Week9_Act6.cfm

There is a problem with this script ...  any clues, or links to examples, would 
be appreciated.

<CFquery name="DeptAverage" datasource="bs3578" >
    SELECT  a.Amount AS aAmount,
                    d.DeptName AS dName,
                    AVG(a.Amount) AS  AverageAward, 
                    SUM(a.Amount) AS  DeptTotal
  FROM  incentiveawards a  
       INNER JOIN  employeedirectory e ON (e.ID = a.RecipientIDfk)
       INNER JOIN  departments d  ON (d.DepartmentID = e.DepartmentIDfk) 
  WHERE  SUM(a.Amount) > 5000 
  GROUP BY  d.DeptName  
  HAVING  AVG(a.Amount) > 3000  
  ORDER BY  AverageAward DESC;    
</CFquery>

<table width="350" border="1" >
<tr>
 <th width="50%" > Department </th>
 <th width="20%" > Total </th> 
 <th width="*" > Average </th> 
</tr>
<CFoutput query="DeptAverage" >
<tr>
    <td align="left" > &nbsp; #dName#</td>
    <td align="Right" > #LSCurrencyFormat(DeptTotal)# &nbsp; </td> 
    <td align="Right" > #LSCurrencyFormat(AverageAward)# &nbsp; </td>  
</tr>
</CFoutput>
</table>




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320875
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to