Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

tep_db_query


_root

Recommended Posts

hello,

please, could somebody tell me what's wrong with this sql request:

 

ERROR DESCRIPTION:

 

1064 - You have an error in your SQL syntax near 'select * from orders where (o.orders_status ='3') or (o.orders_status ='5') or (' at line 1

 

select op.products_id, p.products_model, pd.products_name, count(op.products_id) as total from orders_products as op, products as p, products_description as pd where (op.products_id = p.products_id) and (p.products_id = pd.products_id) and op.orders_id=(select * from orders where (o.orders_status ='3') or (o.orders_status ='5') or (o.orders_status ='6')) group by op.products_id, p.products_model, pd.products_name order by pd.products_name

 

CODE:

 

$requete = "select op.products_id, p.products_model, pd.products_name, count(op.products_id) as total from orders_products as op, products as p, products_description as pd where (op.products_id = p.products_id) and (p.products_id = pd.products_id) and op.orders_id in (select o.orders_id from orders as o where (o.orders_status ='3') or (o.orders_status ='5') or (o.orders_status ='6')) group by op.products_id, p.products_model, pd.products_name order by pd.products_name";

 

$produits_commandes = tep_db_query($requete);

 

thanks in advance!

Link to comment
Share on other sites

hello,

please, could somebody tell me what's wrong with this sql request:

 

ERROR DESCRIPTION:

 

1064 - You have an error in your SQL syntax near 'select * from orders where (o.orders_status ='3') or (o.orders_status ='5') or (' at line 1

 

select op.products_id, p.products_model, pd.products_name, count(op.products_id) as total from orders_products as op, products as p, products_description as pd where (op.products_id = p.products_id) and (p.products_id = pd.products_id) and op.orders_id=(select * from orders where (o.orders_status ='3') or (o.orders_status ='5') or (o.orders_status ='6')) group by op.products_id, p.products_model, pd.products_name order by pd.products_name

 

CODE:

 

$requete = "select op.products_id, p.products_model, pd.products_name, count(op.products_id) as total from orders_products as op, products as p, products_description as pd where (op.products_id = p.products_id) and (p.products_id = pd.products_id) and op.orders_id in (select o.orders_id from orders as o where (o.orders_status ='3') or (o.orders_status ='5') or (o.orders_status ='6')) group by op.products_id, p.products_model, pd.products_name order by pd.products_name";

 

$produits_commandes = tep_db_query($requete);

 

thanks in advance!

 

SOLUTION:

 

Subrequests are only supported from the version 4.1 of mysql and I have the version 3.58.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...