Author Topic: Data table grouped by month  (Read 365 times)

Offline ukdub

  • Jr. Member
  • **
  • Posts: 16
    • View Profile
Data table grouped by month
« on: 02/August/2012, 01:08:48 PM »
It would be great to list data grouped by Month. Is this on the features watch list?

I am trying to create a MYSQL View to achieve a list of net totals grouped by month, this is my best guess so far.

============================

SELECT YEAR(`document_date`), MONTHNAME(`document_date`),
SUM(total_net), SUM(total_gross)
FROM jos_nbill_document

GROUP BY YEAR(`document_date`), MONTH(`document_date`)

============================

Offline ukdub

  • Jr. Member
  • **
  • Posts: 16
    • View Profile
Re: Data table grouped by month
« Reply #1 on: 02/August/2012, 01:13:30 PM »
... but the date format seems to be incompatible with these queries

Offline netshine

  • Administrator
  • Hero Member
  • *****
  • Posts: 4,984
    • View Profile
Re: Data table grouped by month
« Reply #2 on: 02/August/2012, 02:09:03 PM »
Dates in nBill are stored as Unix Timestamps, so to use MySQL date functions you have to convert them into MySQL dates using the FROM_UNIXTIME function.