如果在查询中添加LIKE,如何具有相同的输出

时间:2019-07-15 08:35:24

标签: mysql

表1

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
  <div class="row">
    <div class="col-sm-3">
     <div class="row">ipsum</div>
      <div class="row"> amet,</div>
      <div class="row"> elit,</div>
    </div>
    <div class="col-sm-6">
      <div class="row">Lorem ipsum</div>
      <div class="row">dolor sit amet,</div>
      <div class="row">consecteur adipiscing elit,</div>
    </div>
    <div class="col-sm-3">
     <div class="row">Lorem ipsum</div>
      <div class="row">dolor</div>
      <div class="row">consecteur</div></div>
  </div>
</div>

表2

  *Table shortlisted_details*
  ---------------------------
  id    employee_id    shortlisted_master_id
  ---------------------------------------------
  1        12117        136
  2        13133        136
  3        11114        136 
  4        12117        116
  5        12117        203

表3

  *Table shortlisted_master*
  ------------------------
  id    filter_details_id
  -------------------------
  1      136
  2      162
  3      169
  4      116
  5      203

这是我的查询

 *Table employees*
 ---------------
 id     first_name
 ------------------
 12117  Faith
 13133  David
 11114  Noel

这是输出

 SELECT COUNT(sd.id) as 'shortlisted_count',
    sm.filter_details_id as Filter_ID

    FROM shortlisted_details sd

    INNER JOIN employees e ON e.id= sd.employee_id

    INNER JOIN shortlisted_master sm ON sm.id=sd.shortlisted_master_id

    WHERE sd.is_disqualified=0 AND sm.filter_details_id = 136

        GROUP BY sm.id

但是如果我将 *Result* shortlisted_count Filter_ID --------------------------------- 3 136 的位置更改为这是查询的输出

" WHERE sd.is_disqualified=0 AND sm.filter_details_id = 136 AND e.first_name LIKE '%Faith%' "

但是即使我添加了LIKE,我想发生的还是第一个输出的相同输出

0 个答案:

没有答案