ExpectedI有两个日期选择器,FromDate和ToDate。用户将为每个值选择日期。
FromDate: 01/JUL/2012 ToDate: 31/OCT/2014
这是我的疑问:
$query = mssql_query("SELECT count(*), month(startdate) as month,
year(startdate) AS year
FROM user
WHERE startdate >= 'FromDate' and Todate >= 'ToDate'
GROUP BY month(startdate), year(startdate)
ORDER BY year(startdate) ASC, month(startdate) ASC");
我得到按月和年分组的所有总记录,但我不知道如何将其存储在php数组中。
示例结果:
JUL AUG SEP OCT NOV DEC
Array2012 =(" 52"," 45",#34; 25"," 62"," 11" " 41&#34)
JAN FEB MAR DEC
Array2013 =(&#34; 52&#34;,&#34; 45&#34;,&#34; 25&#34;,......,&#34; 35&#34;)< / p>
JAN FEB MAR OCT
Array2014 =(&#34; 52&#34;,&#34; 45&#34;,&#34; 25&#34;,.......,&#34; 47&#34;)
2012 2013 2014
ArrayTotal =(&#34; 741&#34;&#34; 624&#34;&#34; 412&#34)