Riddhi Valecha

Riddhi Valecha

  • 441
  • 3.3k
  • 411.5k

SQL Query - uniqueness in combination

Jun 2 2015 6:20 AM
Hi all,
 
I have a table as -
 ID Code Value
 1 101 abc
 2 101 def
 3 201 abc
 4 101 def
 
Now,
 
In this table, I need to check the uniqueness in combination -
101 - abc  ---> allowed.
101 - def ---> allowed.
101 - def ->> NOT ALLOWED.... Combination "101 - def" exists.
Similarly,
Combination "101 - abc" must not be allowed next time.
 
How to check this combination uniqueness in SQL Server ??
 
Please help !! 
 
 

Answers (5)