How to use MySQL UNION in qa_db_query_sub function?

Post date: 2020-08-11 05:24:21
Views: 181

Although it seems that qa_db_query_sub function will be deprecated in Q2A 1.9.0, but still I would like to ask how to use MySQL UNION in qa_db_query_sub function?

This simple SELECT function works well

SELECT postid FROM  `qa_posts`  WHERE `type`="Q"  ORDER  BY created DESC  LIMIT  1

qa_db_read_all_assoc(qa_db_query_sub('SELECT postid FROM  `qa_posts`  WHERE `type`="Q"  ORDER  BY created DESC  LIMIT  1'));

But this compound function doesn't work:

SELECT postid FROM  `qa_posts`  WHERE `type`="Q"  ORDER  BY created DESC  LIMIT  1 UNION ALL SELECT postid FROM  `another_posts`  WHERE `type`="Q"  ORDER  BY created DESC  LIMIT  1

Or even this doesn't work either

(SELECT postid FROM  `qa_posts`  WHERE `type`="Q"  ORDER  BY created DESC  LIMIT  1) UNION ALL (SELECT postid FROM  `another_posts`  WHERE `type`="Q"  ORDER  BY created DESC  LIMIT  1)

qa_posts and another_posts have the same structure in this example.

Please click Here to read the full story.
 
Other Top and Latest Questions:
Trump vows Iran will be 'living in Hell' by Tuesday if Strait of Hormuz deadline missed
Zohran Mamdani and the business exodus? New York's office real estate market is up under new mayor
Anthropic limits Mythos AI rollout over fears hackers could use model for cyberattacks
AWS teams working around the clock to keep Middle East services up after drone strikes, CEO says
Delta, Southwest raise checked bag fees $10 amid jet fuel price surge, joining other carriers
Two-gender musical duos?
Movie: The Children's Train
Robinhood’s Trump Accounts partnership signals big upside for the stock, analysts say
Epstein files: Ex-AG Pam Bondi’s April 14 testimony before House Oversight to be rescheduled
Markets shift back towards potential Fed rate cut this year with Iran ceasefire in place