0

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.

3
  • Does this answer your question? Complex Wordpress query using multiple queries Commented Oct 23, 2021 at 21:59
  • Thanks nbk. Have seen this one before. But I don't think I can split my query into separate queries like in this example. Commented Oct 24, 2021 at 6:58
  • yes you can user defined variables are valid for a session or switch to a stored procedure. Commented Oct 24, 2021 at 10:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.