title: Need Pattern for dynamic search of multiple sql tables
body: <p>I'm looking for a pattern for performing a dynamic search on multiple tables.</p>
  
  <p>I have no control over the legacy (and poorly designed) database table structure.</p>
  
  <p>Consider a scenario similar to a resume search where a user may want to perform a search against any of the data in the resume and get back a list of resumes that match their search criteria.  Any field can be searched at anytime and in combination with one or more other fields.</p>
  
  <p>The actual sql query gets created dynamically depending on which fields are searched.  Most solutions I've found involve complicated if blocks, but I can't help but think there must be a more elegant solution since this must be a solved problem by now.</p>
  
  <hr>
  
  <p>Yeah, so I've started down the path of dynamically building the sql in code.  Seems godawful.  If I really try to support the requested ability to query any combination of any field in any table this is going to be one MASSIVE set of if statements.  <em>shiver</em></p>
  
  <hr>
  
  <p>I believe I read that COALESCE only works if your data does not contain NULLs.  Is that correct?  If so, no go, since I have NULL values all over the place.</p>