title: SQL substring Issue ( Where substring(...) = (select....) )
body: <p>I'm trying to search only the dirname from full path using this queries.</p>
  
  <pre><code>  SELECT 
        `file_name` FROM `tbl_files` where SUBSTR(`file_path`, 
          LOCATE('/',`file_path`)+1, 
            (CHAR_LENGTH(`file_path`) - LOCATE('/',REVERSE(`file_path`)) - LOCATE('/',`file_path`))) =
              (Select `source_path` from `tbl_transcode_folder` where `trancode_folder_id` = 1 )
  </code></pre>
  
  <p>But it return me nothing. When i replace <code>(Select source_path from tbl_transcode_folder where trancode_folder_id = 1 )</code> into it's result <code>mnt/hd/1</code> like the queries below , It's response want i to but i dont want to do in that way.</p>
  
  <pre><code> SELECT 
            `file_name` FROM `tbl_files` where SUBSTR(`file_path`, 
              LOCATE('/',`file_path`)+1, 
                (CHAR_LENGTH(`file_path`) - LOCATE('/',REVERSE(`file_path`)) - LOCATE('/',`file_path`))) = `mnt/hd/1`
  </code></pre>