Suppose i have a table t1:
What i want to know is, for a unique product id i want to see if there has been a new price.
Only having constant values for a specific product id is of not interest.
Would appreciate some tips.
My thoughts is something like "Select the product ids’ where its distinct(count(price)) > 1. This should give me only the products ids that has a price change?
If a product id only has the same price without a change, it’s of no interest to select.
Your idea to check
COUNT(DISTINCT price > 1) is correct.
We just need to use
GROUP BY with a
SELECT product_id FROM t1 GROUP BY product_id HAVING COUNT (DISTINCT price) > 1 ORDER BY product_id;