+------------+---------------+---------------+----------------+
| Product ID | Part Sequence | Part Material | Description |
+------------+---------------+---------------+----------------+
| 1 | 1 | Steel | Part A |
| 1 | 2 | CFK | Part B |
| 1 | 3 | CFK | Part B Variant |
| 1 | 4 | Steel | Part C |
| 1 | 5 | GFK | Part D |
| 1 | 6 | Plastic | Part E |
| 2 | 1 | Steel | Part A |
| 2 | 2 | CFK | Part B |
| 2 | 3 | Steel | Part F |
| 2 | 4 | CFK | Part B |
| 2 | 5 | Steel | Part G |
| 2 | 6 | Silicon | Part D+ |
| 2 | 7 | Plastic | Part E |
+------------+---------------+---------------+----------------+
(the ordering by Product ID and Part Sequence is only done for readability, my db table is unorderd)
I need to query all rows for each product id with a part sequence equal or higher to the last steel part.
So for the table above the expected result would be:
+------------+---------------+---------------+----------------+
| Product ID | Part Sequence | Part Material | Description |
+------------+---------------+---------------+----------------+
| 1 | 4 | Steel | Part C |
| 1 | 5 | GFK | Part D |
| 1 | 6 | Plastic | Part E |
| 2 | 5 | Steel | Part G |
| 2 | 6 | Silicon | Part D+ |
| 2 | 7 | Plastic | Part E |
+------------+---------------+---------------+----------------+
I could use the solution from SQL Select only rows with Max Value on a Column FILTERED by Column to find the last steel part and then filter anything with a higher part sequence, but I'm hoping for a more efficient solution.