title: SQL Constraint that one column value cannot be greater than another in a different table
body: <p>This probably isn't a very nice question as its blending business logic with DB structure, but its not my decision so:</p>
  
  <p>Is it possible to define a constraint the infers the value of one column (Table A, Column X) cannot be greater than the value of another (Table B, Column Y) referenced via a foreign key:</p>
  
  <pre><code>TABLE_A
      ID (Primary Key)
      X (int value)
  TABLE_B
      A_ID (Foreign Key to TABLE_A)
      Y (int value)
  </code></pre>
  
  <p>i.e. I want to enforce that for all values of Y, Y &lt; L where L is a value from X where TABLE_B.A_ID == TABLE_A.ID</p>
  
  <p>I'm working with DB2.</p>