title: Select from table if record found in another table
body: <p>I need to select some rows from Table 1 lets say if a value is found in Table 2. So I want to check if the value (I will enter the value from command line) is found in Table 2 and then select rows from Table1, if not I want to select rows from another table. 
  I tried CASE but from what I got that works only if you want to check for value within one table. Any idea?</p>