I want a query to display the number of containers that only contain products so the date is less than 01/01/2019 and date is not null..
Example:
my table : tab
| Num_Container | Num_Product | Date_Product |
|---|---|---|
| 1 | A1 | 01/01/2020 |
| 1 | A2 | 01/01/2018 |
| 1 | A3 | 01/01/2021 |
| 2 | A4 | 01/01/2017 |
| 2 | A5 | 01/01/2018 |
| 2 | A6 | 01/01/2019 |
| 3 | A7 | Null |
| 3 | A8 | 01/01/2019 |
| 3 | A9 | 01/01/2016 |
The expected result is:
| Num_Container |
|---|
| 2 |
The containers must contain only products less than or equal to the date 01/01/2019 and date is not null.