This topic is locked
[SOLVED]

  Pareto Chart

11/2/2011 6:53:07 AM
PHPRunner General questions
S
Smithy author

Hi,
I am trying to create a Pareto bar chart. The SQL statement I am trying to use is:



SELECT

WhatIDrank,

COUNT(DiaryKey) AS `Drink Count`

FROM tblfooddiarydetails

GROUP BY WhatIDrank

ORDER BY `Drink Count` DESC


The output from the 'results' window is :
Water 60

Descaffinated Coffee 37

nothing 35

(blank) 6
But when I click 'next' I get the following error:

"ORDER BY fields must match SELECT fields.

You may let Runner to fix SQL query automatically or fix it by hand."
It has some options around Auto, Manual, Skip.
I click Auto, build the project and upload it to my site.
Then, when I check the chart on website I get the error:

"XML Parser failure.

The element type must terminated by the matching end-tag.".
(instead fo the bar chart in descending order).
Does anyone have any hints as to the best way to create a pareto chart ?
Thanks in advance.
Craig

Sergey Kornilov admin 11/2/2011

Try this:

SELECT

WhatIDrank,

COUNT(DiaryKey) AS `Drink Count`

FROM tblfooddiarydetails

GROUP BY WhatIDrank

ORDER BY COUNT(DiaryKey) DESC


Some databases won't allow you to sort data by alias.

S
Smithy author 11/3/2011

Thankyou Sergey - once again you've come to the rescue.
This works really well now.....
--------



Try this:

SELECT

WhatIDrank,

COUNT(DiaryKey) AS `Drink Count`

FROM tblfooddiarydetails

GROUP BY WhatIDrank

ORDER BY COUNT(DiaryKey) DESC


Some databases won't allow you to sort data by alias.