0
votes

I have a similar to below:

ProductID Division OrdNum
1 011 123
1 705 123
1 660 123
2 011 511
2 705 412
2 660 216

I am trying to write a query that will return each product ID and if the OrdNum for all Divisions is the same it will return the OrdNum, and if the OrdNums are different it will return "Varies"

The results should look like this:

ProductID OrdNum
1 123
2 Varies