MySQL Forums
Forum List  »  MyISAM

SQL SELECT Join?
Posted by: Manuel Lukas
Date: March 20, 2010 03:14AM

Hey,
I am not sure if this is the right forum. But i got a problem.
I got an MySQL DB with MyISAM tables. The two relevant tables are:

* orders_products: orders_products_id, orders_id, product_id, product_name, product_price, product_name, product_model, final_price, ...
* products: products_id, manufacturers_id, ...

(for full information about the tables see screenshot products (http://img37.imageshack.us/img37/4585/producty.jpg) and screenshot orders_products (http://img188.imageshack.us/img188/3418/ordersproducts.jpg)

Now what I want is this: - Get all Orders who ordered products with manufacturers_id = 1. And the product name of the product of this order (with manufacturers_id = 1). Grouped by orders.

What I did so far is this:
SELECT
op.orders_id,
p.products_id,
op.products_name,
op.products_price,
op.products_quantity
FROM orders_products op , products p
INNER JOIN products
ON op.products_id = p.products_id
WHERE p.manufacturers_id = 1 AND
p.orders_id > 10000


p.orders_id > 10000 for testing to get only a few order_id's. But thies query takes much time to get executed if it even works. Two times the sql server stucked. Where is the mistake?

Options: ReplyQuote


Subject
Views
Written By
Posted
SQL SELECT Join?
3569
March 20, 2010 03:14AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.