Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help with SQL


douglaswalker

Recommended Posts

Hi there

I am trying to access 3 tables in Oscommerce Database to pull some orders showing products and attributes but cant get it to work. Just says I have an error in my SQL

I am selecting from orders  and  orders_products and orders_products_attributes  linked by orders_id...

 

This is the original

$products_query = tep_db_query("SELECT  op.products_model, op.orders_id, op.products_quantity FROM orders_products op LEFT JOIN orders o ON op.orders_id = o.orders_id where op.orders_id IN (" . $orders_implode . ") and op.clubosc_shipping_type != 'dropshipped' ORDER BY op.orders_id DESC, op.products_id DESC");
    

This is what I have attempted

$products_query = tep_db_query("SELECT  op.products_model, op.orders_id, op.products_quantity, opa.orders_id, opa.products_options_values, FROM orders_products op, orders_products_attributes opa LEFT JOIN orders o ON op.orders_id = o.o orders_id JOIN orders_products op ON opa.orders_id = op.op orders_id where opa.orders_id IN (" . $orders_implode . ") and op.clubosc_shipping_type != 'dropshipped' ORDER BY op.orders_id DESC, op.products_id DESC");
    

 

Link to comment
Share on other sites

On 7/16/2022 at 8:22 AM, douglaswalker said:

op.orders_id = o.o orders_id

 

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...