The clause in your query
where order_date <> curdate() is going to return all the product and order details except for today's because of the not equals.
The answer to this is to make that a greater-than-or-equal-to.
SELECT *
FROM product_table p
JOIN order_table o on p.p_id = o.p_id
WHERE order_date >= curdate()
This will; however, still contain products that were sold in the past. So the next thing to do will be to add in a
sub-query to remove the products from the past. To get the Product IDs from past sales will be
SELECT p_ID FROM order_table WHERE order_date < curdate()
and this will be added into the original query with a
NOT IN clause to remove them
SELECT *
FROM product_table p
JOIN order_table o on p.p_id = o.p_id
WHERE order_date >= curdate()
AND p.p_id NOT IN (
SELECT p_ID
FROM order_table
WHERE order_date < curdate()
)
Now this query is going to give you all the product details but it is also going to contain all the order details as well. And if there were multiple purchasers of the same product they will return multiple rows for the same product. If we want to reduce this we will remove the JOIN statement and work it in as a sub-query.
SELECT *
FROM product_table p
WHERE p.p_id IN (
SELECT p_ID
FROM order_table
WHERE order_date >= curdate()
)
AND p.p_id NOT IN (
SELECT p_ID
FROM order_table
WHERE order_date < curdate()
)