This topic is locked

MonthName problem

9/27/2009 12:08:08 PM
PHPRunner General questions
G
glazer author

I have a field of dates under the name Date. In the SQL for a chart I write GROUP BY MonthName(Date), but I get an error message saying the function is not defined. Any ideas? If I write GROUP BY Month(Date) it works.

mikue from germany 9/27/2009

Try to change or adapt sql
I have working that sql in a chart and it works as wanted with names ; phpr 5.1 (2503)
SELECT

concat(monthname(Date), ' / ', year(Date)) AS Date,

COUNT(Kunde) AS amount

FROM Table

GROUP BY Date

G
glazer author 9/28/2009

I tried this but again the concat function is not recognised in my SQL

mikue from germany 9/28/2009

please gimme very more information

  • copy complete sql statement here
  • where do you try to put the code?
  • version of phpr?

G
glazer author 9/28/2009



please gimme very more information

  • copy complete sql statement here
  • where do you try to put the code?
  • version of phpr?



I am using PHPRunner 5.1. I have the following working SQL for charts (on the Edit SQL query page)

SELECT

Month([Date]) AS [Month],

COUNT([Date]) AS Totals

FROM [Register of events]

GROUP BY Month([Date])
and this creates a field containing month numbers. I would like if possible to change this month names. I thought the function MonthName would do it but that doesnt work.

G
glazer author 9/28/2009

I should explain a bit more. I have an access database with two fields, "date" and "register of events". What I want to do in PHPRunner is create a chart plotting the number of "register of events" in each month against month, in which the lable month refers to names of months rather than to numbers.

J
Jane 9/28/2009

Mike,
Please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.

mikue from germany 9/28/2009

I was creating that sql query within access and it works great.

Then I was using that query as basic table for chart building within phpr.
If you wanna have full month names,

you must use a special ms access format to format the date field:
AnyName: Format([DateColumn];"mmmm")
But I am eager to know the solution from Jane also .. without preparation in access.

G
glazer author 9/29/2009



But I am eager to know the solution from Jane also .. without preparation in access.



This is the solution Jane sent me and it works great!

  • create new table (Table1) in your database with two fields: monthnumber (Number) and monthname (text),
  • fill this table with correct values,
  • create new view (Query1) in the database.

    Here is a sample query:

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

    SELECT Month([Date]) AS monthnumber, COUNT([Date]) AS Totals FROM [Main Table] GROUP BY Month([Date]);

    ----------------------------------
  • run PHPRunner, create new chart based on the created query, edit SQL query for this chart in the following way:

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

    SELECT

    MonthName,

    Totals

    FROM Query1 inner join Table1

    on Query1.monthnumber=Table1.Monthnumber



mikue from germany 9/29/2009

Ahh OK no format string, only possible with help table - but why not, finally the result counts.

Thanks for sharing the ACCESS workaround.