Jump to content

The "*" operator cannot be used in a nested query.


Pau111111

Recommended Posts

In my custom SQL querys of backoffice apears this error (The "*" operator cannot be used in a nested query.) when I use this: "(SELECT SUM(total_paid_real / conversion_rate) FROM ps_orders o WHERE o.id_customer = a.id_customer AND o.id_shop IN (1) AND o.valid = 1)  > 0" in the last WHERE but in phpmyadmin the code works...

 

I can't resolve this problem.

 

Thanks in advance.

Link to comment
Share on other sites

(SELECT SUM(total_paid_real / conversion_rate) FROM ps_orders o WHERE o.id_customer = a.id_customer AND o.id_shop IN (1) AND o.valid = 1)  > 0

this query does not look anywhere near complete or valid

 

Full query:

 

SELECT DISTINCT a.`id_customer`, addr.dni, a.`firstname`, a.`lastname`,a.`company`,a.`email`, addr.phone, addr.alias, addr.`address1`, addr.`address2`, addr.city, st.name AS province, addr.postcode, a.`active` AS `active`,a.`newsletter`,a. `optin` , a.date_add, gl.name as title, gr.name AS grupo, ( SELECT SUM(total_paid_real / conversion_rate) FROM ps_orders o WHERE o.id_customer = a.id_customer AND o.id_shop IN (1) AND o.valid = 1 ) as total_spent, ( SELECT c.date_add FROM ps_guest g LEFT JOIN ps_connections c ON c.id_guest = g.id_guest WHERE g.id_customer = a.id_customer ORDER BY c.date_add DESC LIMIT 1 ) as connect FROM `ps_customer` a LEFT JOIN ps_gender_lang gl ON (a.id_gender = gl.id_gender AND gl.id_lang = 1) LEFT JOIN ps_group_lang gr ON a.id_default_group=gr.id_group AND gr.id_lang=a.id_lang LEFT JOIN ps_address addr ON a.id_customer=addr.id_customer LEFT JOIN ps_state st ON addr.id_country=st.id_country AND addr.id_state=st.id_state WHERE ( SELECT SUM(total_paid_real / conversion_rate) FROM ps_orders o WHERE o.id_customer = a.id_customer AND o.id_shop IN (1) AND o.valid = 1 ) > 0 AND 1 AND a.`deleted` = 0 ORDER BY `date_add` DESC

 

In the end you can see the last part of query

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

  • 5 years 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...