Working in SQL Server 2012.
I'm trying to find rows in my table where an ID exists with only 1 distinct value in another field:
My table looks something like this:
CREATE TABLE #tmpMyTable (
MyID int NULL,
MyField char NULL
INSERT INTO #tmpMyTable
VALUES (1, 'A'),
The query I'm trying to build would return the following:
I feel like this should be fairly simple but I'm failing miserably at it. I've tried a SELF JOIN, GROUP BY, OVER PARTITION BY, etc. and I can't seem to get it.
Any help will be greatly appreciated!