title: t-SQL - constraint on one column that has multiple conditions
body: <p>I am currently re structuring a poorly designed database, one of the things I want to do for integrity purposes is make a certain record unique dependent on a few variables.</p>
  
  <p>The table I am using is Quotes, the column in question is the Quote number, what I need is for this to be unique to each Company and group, so for example <code>Quote001</code> should be unique unless there is a new company / group used.</p>
  
  <p>So you could have <code>Quote001</code> with <code>company1</code> and <code>group1</code>, but then if a new quote is made with <code>company1</code> and <code>group1</code> the new quote number should be <code>Quote002</code>. However if <code>Company2</code> and <code>group1</code> make a quote it should be back to <code>Quote001</code>.</p>
  
  <p>I am unsure as to how to achieve this most effectively, using constraints in the database.</p>
  
  <p>Thanks,
  David</p>