Okay
  Public Ticket #1721414
SQL Query group by month and year
Closed

Comments

  • ADRIEN started the conversation

    Hi,

    I recently bought your plugin, it works well and I have no technical issue but I would be REALLY grateful if you could tell me how can I get several series in a chart from one column.

    Let me explain, in my SQL database I have one column with the sales, and another one with the dates (several years), I've managed to SUM the sales by month, but I would need to have separated columns for each years so as to get a serie for each year in the chart.

    It seems that the sql PIVOT function can do it but I don't know if it works with WPDataTables, could you help ?

    Here's my query ("vente" = date | "caht" = sales amount) :

    ---------------------------------------------------

    select  date_format(s1.vente,'%m-%Y')  as month, sum(caht) as CAHT,

    extract(year from vente) as YEAR
    from wp4m_wpdatatable_11 s1
    group by month
    order by s1.vente
    limit 50;

    ---------------------------------------------------


    PS: I'm french so apologies if it's not very clear

    Regards,

    Adrien


  •  472
    Isidora replied

    Hi Adrien,

    Thank you for your purchase.

    Sorry for late response. 

    We are located in Serbia and our working time is from 10:00 to 17:00 CET. business days.

    Unfortunately that is not possible to achieve that with built in options of plugin. What you can try is to make columns from that row with queries. You can take a look on this link one of the option how you can achieve that. When you make query that you need and if is working in your tool for manipulating tables in database(like phpmyadmin) then you can use it in wpdatatables also.

    Best regards.



    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables