I postet this question a few days ago but I didn't explain exactly what I want.
I ask the question better formulated again:
To clarify my problem I added some new information:
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 (Screenshot) and screenshot orders_products (Screenshot))
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?