I recently asked this question here and got some great answers!
Custom SQL GROUP BY Clause
However, it turns out I provided the wrong requirements for my problem. Sorry guys!
Sooooo. What I need to select is:
Distinct values in the Column ‘PartNumbers’, however:
–>For EACH unique PartNumber, I want to select the specific ROW from that table that has the MAX VALUE of the ‘PO’ Column for that particular part number.
–>Also, to make life more difficult, I want to exclude the ANY of the PartNumbers who have ANY VALUE in the Column ‘Receipt’
You guys have been a great help! Much appreciated everyone!
EDIT:
Table Name: Log
Columns: ID, Supplier, PartNumber, PO, Quantity, DateReceived
Note: only the ID column is unique.
Using CTE: