如何使用cfoutput按日期输出表结果? [英] How to output table results by using cfoutput group by date?

查看:257
本文介绍了如何使用cfoutput按日期输出表结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个查询,让所有的员工在表中计数:

I have a query that get the all the employees count in a table:

emp_namelast | emp_namefirst | employeetotal | year_cse1
--------------------------------------------------------
smith        | john          | 13            | 2014
smith jr     | jonnny        | 10            |2014
baker        |jane           |5              |2015
doe           |john           |6             |2015


$ b b

我在表中输出结果。我有查询的顺序的结果。
但是下面的代码输出了2014年的最高结果,然后从2015年的顶部
结果。

I'm outputting the results in a table. I have the results in order from the query. But with the code below it's outputting the top result from 2014 and then the top result from 2015.

我试过使用没有组,这给我所有的查询数据。
我想在两个不同的表中输出2014年和2015年的数据。
一个将包含2014年和其他2015年的记录。

I have tried using no group , which gives me all the data from the query. I would like it to output the data from 2014 and 2015 in two different tables. One would contain records for 2014 and the other 2015.

是否必须在不使用组的情况下完成?

Would it have to be done without using a 'group'?

<h2>employees</h2>

<table >
    <thead><tr><th>Employee</th><th>Stars</th></tr></thead>
    <tbody> 
        <cfoutput query="GetEmployeeTotals" group="year_cse1">  
            <tr><td>#emp_namefirst# #emp_namelast#</td>
                <td>#employeetotal#</td>
            </tr>   
        </cfoutput>
    </tbody>
</table>


推荐答案

您处于正确的轨道, 。组属性的工作方式如下:

You are on the right track but are missing a detail. The group attribute works like this:

<cfoutput query="somequery" group="somefield">
grouped data goes here

<cfoutput>
ungrouped data goes here
</cfoutput>
grouped data can go here as well
</cfoutput>

在您的代码中,您不输出任何分组数据,并且缺少额外的cfoutput标记未分组的数据。

In your code, you are not outputting any grouped data, and you are missing the extra cfoutput tags for the ungrouped data.

这篇关于如何使用cfoutput按日期输出表结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆