title: How to skip defined Combinations in sql?
body: <p>--A=100,B=50,C=200</p>
  
  <pre><code>DECLARE @T1 TABLE (CAT1 VARCHAR(1),CAT2 VARCHAR(1),MinVal int)
  INSERT INTO @T1
  SELECT 'A','A',100
  UNION ALL
  SELECT 'A','B',50
  UNION ALL
  SELECT 'A','C',100
  UNION ALL
  SELECT 'B','A',50
  UNION ALL
  SELECT 'B','B',50
  UNION ALL
  SELECT 'B','C',50
  Union all
  SELECT 'C','A',100
  UNION ALL
  SELECT 'C','B',100
  UNION ALL
  SELECT 'C','C',200
  
  select * from @T1
  </code></pre>
  
  <p>I have to calculate sum of MinValue 
  which should include only (AB,AC,BC) as whatever min of AB=BA so need to take one only.</p>
  
  <p>so in result  i want to get 3 rows out of 9.</p>
  
  <pre><code>Cat1|Cat2|MinVal
  A|B|50
  A|C|100
  B|C|50
  </code></pre>
  
  <p>Any help will be highly appreciated.</p>
  
  <p>Earlier i tried the things below but it did not work.</p>
  
  <pre><code>Select * from @T1 where Cat1&lt;&gt;Cat2 and ?
  </code></pre>
  
  <p>(what condition i need to write to avoid undesired combination.)</p>
  
  <p>Here's <a href="https://www.sqlteam.com/forums/topic.asp?TOPIC_ID=143066" rel="nofollow noreferrer">a link</a></p>