Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL blank screen - Pie Chart - percent format #133

Open
estebanutz opened this issue Aug 14, 2023 · 0 comments
Open

MySQL blank screen - Pie Chart - percent format #133

estebanutz opened this issue Aug 14, 2023 · 0 comments

Comments

@estebanutz
Copy link

I'm experiencing something similar with this MySQL query. I get a blank screen using the "Percent" format on a pie chart. Running it on my MySQL client, I get a count result for both statuses but a blank screen in the admin area. With my data, I'm getting 75 verified and 25 pending. When I select "Table" to "Display as" it shows the table with the correct data.

Is there something I'm doing wrong? Thanks for the help! Here's the query below:

SELECT status_description,
    FORMAT(COUNT(1) / total_count * 100, 0) AS count
FROM (
    SELECT
        c.status,
        CASE
            WHEN status = 0 THEN 'Pending'
            WHEN status = 1 THEN 'Verified'
            ELSE 'Unknown'
        END AS status_description
    FROM customers as c
) AS subquery
CROSS JOIN (
    SELECT COUNT(1) AS total_count
    FROM customers
) AS total_counts
GROUP BY status_description, total_count;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant