I’m working on a project where I’m trying to combine three different tables.
Table 1 and 2 got a row with the same ID,which in this case is the product_id, and the same goes for table 2 and 3. I’m using date as a condition when I’m sending the query, where I’m only supposed to get the results that fit inside the given frame. Here’s my code:
select order.orderDate, orderLine.order_id, product.product_id, product.name
from order, product
inner join orderLine
on product.product_id = orderLine.product_id
where order.orderDate between '2009-09-01' and '2009-09-30' ;
When I use this, I only get one date, contained in the order-table. I also get info from rows that don’t fit the date given.
I’m very sorry if this is nothing but confusing. My english isn’t very good, so having a hard time making this understandable. Also, please let me know if you need more information. New to both this site and SQL.
Try joining all three tables: