title: SQL -- SELECT statement -- concatenate strings to
body: <p>I have an SQL question.  Everything works fine in the below SELECT statement except the portion I have highlighted in bold.  What I'm trying to do is allow the user to search for a specific Rule within the database.  Unfortunately, I do not actually have a Rule column, and so I need to concatenate certain field values to create a string with which to compare to the user's searchtext.</p>
  
  <p>Any idea why the part in bold does not work?  In theory, I would like this statement to check for whether the string "Rule " + part_num (where part_num is the value contained in the part_num field) equals the value of searchtext (the value of searchtext is obtained from my PHP script).</p>
  
  <p>I did some research on concatenating strings for SQL purposes, but none seem to fit the bill.  Does someone out there have any suggestions?</p>
  
  <pre><code>SELECT id, 
         part_num, 
         part_title, 
         rule_num, 
         rule_title, 
         sub_heading_num, 
         sub_heading, 
         contents 
  FROM   rules 
  WHERE  part_title LIKE "%'.$searchtext.'%" 
          OR rule_title LIKE "%'.$searchtext.'%" 
          OR sub_heading LIKE "%'.$searchtext.'%" 
          OR contents LIKE "%'.$searchtext.'%" 
          OR "rule" + part_num LIKE "%'.$searchtext.'%"  --RULE PLUS PART_NUM DOESN'T WORK
  ORDER  BY id; 
  </code></pre>