Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Coldfusion 按月份分组查询结果_Coldfusion_Coldfusion 9 - Fatal编程技术网

Coldfusion 按月份分组查询结果

Coldfusion 按月份分组查询结果,coldfusion,coldfusion-9,Coldfusion,Coldfusion 9,我有一个coldfusion查询结果,它只包含日期 像 我想显示按月份分组的查询结果 e、 g 第一列为月份名称,第二行为该月份的日期。 我不知道如何在这种情况下对查询进行分组。更新您的查询,使其具有年和月列。您不指定DMB,但对于MSSQL,您将使用year()、month()和day()函数。确保您的查询按年、月、日排序,否则分组将无法正常工作。ColdFusion还有一个内置函数,调用该函数可以将整数转换为月份名称 SELECT year(datecolumn) AS Year, mont

我有一个coldfusion查询结果,它只包含日期

我想显示按月份分组的查询结果

e、 g 第一列为月份名称,第二行为该月份的日期。
我不知道如何在这种情况下对查询进行分组。

更新您的查询,使其具有
列。您不指定DMB,但对于MSSQL,您将使用
year()
month()
day()
函数。确保您的查询按年、月、日排序,否则分组将无法正常工作。ColdFusion还有一个内置函数,调用该函数可以将整数转换为月份名称

SELECT year(datecolumn) AS Year, month(datecolumn) AS month, day(datecolumn) AS day, other, columns
FROM mytable
WHERE x = y
ORDER BY year, month, day
输出为

<cfoutput query="myquery" group="year">
  <cfoupt group="month">
    #monthAsString(month)#
    <cfoutput group="day">
      #day# #other# #columns#
    </cfoutput>
  </cfoutput>
</cfoutput>

#Monthastring(月)#
#day###其他##专栏#

更新您的查询,使其具有
列。您不指定DMB,但对于MSSQL,您将使用
year()
month()
day()
函数。确保您的查询按年、月、日排序,否则分组将无法正常工作。ColdFusion还有一个内置函数,调用该函数可以将整数转换为月份名称

SELECT year(datecolumn) AS Year, month(datecolumn) AS month, day(datecolumn) AS day, other, columns
FROM mytable
WHERE x = y
ORDER BY year, month, day
输出为

<cfoutput query="myquery" group="year">
  <cfoupt group="month">
    #monthAsString(month)#
    <cfoutput group="day">
      #day# #other# #columns#
    </cfoutput>
  </cfoutput>
</cfoutput>

#Monthastring(月)#
#day###其他##专栏#

您使用的数据库引擎是否具有允许您将日期强制转换为字符串的功能?@DanBracuk为什么要将日期强制转换为字符串?Matt的答案会帮助您实现。您使用的数据库引擎是否具有允许您将日期强制转换为字符串的功能?@DanBracuk为什么要将日期强制转换为字符串弦?马特的回答会让你达到目的。