I have a SQL Server 2008 table with the following columns:
ID = uniqueidentifier
EntryID = uniqueidentifier
EntryType = nvarchar(128)
In this table some of the rows may have the same EntryType value. What I want to do is run a query that will return me the rows where the EntryType field is unique. The only way I thought of doing this is to group by this field then check for groups with just a single entry. Here is some example data:
11C5AEEB-6435-489D-B353-6E8D63FCD1AD, 46F95579-0AB6-4EAC-927C-7259C2F1E046, Ford
01DBC8EE-78E4-4544-A816-87086BD45DDE, EBB689E3-1379-4E22-98B2-C6BD8EBB0F9D, VW
E948C6D2-0E6E-4AC7-9799-83C5EB180219, 46F95579-0AB6-4EAC-927C-7259C2F1E046, Ford
E70806DC-9D43-4341-AEF8-4252612AF00B, 3A3D2602-DB92-412B-AA4E-8FA70438A00A, Ford
D4460A15-2C4B-475E-B5D9-82C625C10DF7, 3EA31E10-4941-46D3-B241-B091259A2AF4, Lexus
I want to run a stored procedure that when applied to the above data will just return the VW entry as the EntryType column is unique.
1 Answer