sql query not working on table creation, but works on phpmyadmin
-
Hi,
I’m trying to create a new wpdatatable from a SQL query, I tested the query on phpmyadmin and it generates the desired results, but I get an error message on WPDatatables trying to make that query.WITH top10 AS( SELECT name, market_cap FROM coindata ORDER BY market_cap DESC LIMIT 10 ) SELECT * FROM top10 UNION ALL SELECT 'All other' AS NAME, SUM(market_cap) AS market_cap FROM coindata WHERE name NOT IN( SELECT name FROM top10 )
Query explanation: selects the Top 10 items by market_cap and ads a column in the bottom as “All Other” with the sum of all other market_cap that are not in the top10.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘sql query not working on table creation, but works on phpmyadmin’ is closed to new replies.