title: SQL Server computed column select from another table
body: <p>I'm not to sure what the best way to go about this is, so i'll describe what the end goal is, and if a computed column is the answer then please help me go that route, or perhaps a better route.</p>
  
  <p>I have two tables:</p>
  
  <p><strong>Orders</strong></p>
  
  <pre><code>OrderId
  PackageId
  MediaSpend
  TotalAdViews (Computed column)
  </code></pre>
  
  <p><strong>Packages</strong></p>
  
  <pre><code>PackageId
  BaseAdViews
  </code></pre>
  
  <p>Each order is assigned a package that comes with say 1,000 views, you can then buy more media spend to get more views. I wanted to create a column called TotalAdViews which would add BaseAdViews + MediaSpend. From my understanding if persistance is enabled the column won't need to recalculate every time it is queried, which could help performance.</p>
  
  <p>How do I get a value from another table in my computed column? Or please suggest an alternate way of accomplishing my goal.</p>