Skip to content
Advertisement

Obtain the list of new products

I am trying to get a list of new products.

For that, I should look at the date they had movement. If the movement was in 2022, I consider it as new, but if the movement is before 2022, it is no longer new.

If i’m set as a condition that the date of the movement be greater than 2022, could also be returning a product that also had a movement in 2021 without knowing it.

For example:

PH5404 would be considered a new product because its movements are from the current year.

*N0118 would not be a new product, although it had movements in the current year, it already had other movements in previous years.

What would be the best way to obtain only with the products that have been moving in 2022?

Advertisement

Answer

You would need an inner query with a not exists clause:

This way you will fetch the products that has moved this year, but has no movements in an earlier year.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement