Jump to content

Query SELECT not exist with UNION ALL


krypt

Recommended Posts

Goodmorning everyone,

I'm new to the forum and to using prestashop.

I don't know if it's the right section to ask.

I made a query to extract data with SELECT joined together with the UNION ALL. I tested it in the Back Office, in Database-> SQL Manager. When I save the query I get the message "SELECT does not exist". If I use a UNION instead of UNION ALL, it works.

The curious thing is that the same query tested directly by phpmyadmin works.

Have you ever understood such a thing?

I did a counter test even with a more "simple" query and the result is always the same: with UNION ALL error, with UNION it works.

This is the code of the "simple" and also bizarre test, but I just needed to understand.

SELECT
    orderId,
    orderReference
FROM
(SELECT
    o.`id_order` AS `orderId`,
    o.`reference` AS `orderReference`
FROM `ps_orders` o
WHERE o.`reference` IN (210460,210267,210423,210405,210446)
) AS orderDat

UNION ALL

SELECT
    orderId,
    orderReference
FROM
(SELECT
    '***' AS `orderId`,
    o.`reference` AS `orderReference`
FROM `ps_orders` o
WHERE o.`reference` IN (210460,210267,210423,210405,210446)
) AS discountDat

Thank you very much!

Edited by krypt (see edit history)
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...