SQL Server: SELECT rows with MAX(Column A), MAX(Column B), DISTINCT by related columns
- by z531
Scenario:
Table A
MasterID, Added Date, Added By, Updated Date, Updated By,
1, 1/1/2010, 'Fred', null, null
2, 1/2/2010, 'Barney', 'Mr. Slate', 1/7/2010
3, 1/3/2010, 'Noname', null, null
Table B
MasterID, Added Date, Added By, Updated Date, Updated By,
1, 1/3/2010, 'Wilma', 'The Great Kazoo', 1/5/2010
2, 1/4/2010, 'Betty', 'Dino', 1/4/2010
…