I have a rather long and complicated SQL query.
I want to use commands like SET @varible, GROUP_CONCAT, PREPARE, EXECUTE, DEALLOCATE PREPARE, case when, etc.
I need this data from the DB to construct the page.
It works well via the myphpadmin, but I get no results using:
$wpdb->get_results ( $query );
Which I guess isn't the correct function to execute this one. How do I approach it correctly?
How do you execute queries that have more than just a simple select?
Sorry for the long text, here is the full query: query
Deferentially from this answer: WordPress - How to run complex query using PHP
I don't think I can separate my query into subqueries.