Okay, I admit I havent done mysql in like 5 weeks, but I cant be that rusty
This is suppose to be an easy problem:
Table 1 "Products"
[product_id ] | [title ] .....
1 | blah bah
2 | More blah bah
Table 2 "Quantities"]
[quant_id][product_id][date][values..]
1 | 1 | datetime | values...
2 | 2 | datetime | values...
3 | 1 | datetime | values...
4 | 1 | datetime | values...
5 | 2 | datetime | values...
Problem, I want to establish a quantities history, so I need multiple rows in the quantity table to reflect changes made
I'm trying to now query the products table and attach the values of the quantities table for each product. So I order by datetime to get the newest and want to get each newest row for the corresponding product.
My problem is JOINS return every row, group by must come before order which returns the wrong info, subqueries have returned either no or suffered the same product.
I cant simply query each product_id from the products table as that will create possibly hundred of queries.
This problem doesnt seem that difficult to me but for some reason I'm stuck!