Note that there are some explanatory texts on larger screens.

plurals
  1. POUNION generate duplicate rows
    primarykey
    data
    text
    <p>I know that By default <code>UNION</code> does'nt generate duplicate rows. But in this case as I used the column <code>sort_col</code> for sorting purpose and that way <code>UNION</code> generate duplicate rows(actually not duplicate as <code>sort_col</code> is distinct in each <code>select</code>). To clarifie see this answer and the <a href="https://stackoverflow.com/a/8582591/2826057"><strong>comments</strong></a> also How to overcome this?</p> <pre><code>$key_word_1 = $what; $key_word_2 = $what."%"; $key_word_3 = "%".$what."%"; (SELECT 1 AS sort_col, chair.id_user, chair.company, chair.district, chair.summary, chair.place, products.name FROM chair LEFT JOIN products ON chair.id_user = products.id_user WHERE ( chair.district LIKE ? AND chair.place LIKE ? ) AND ( chair.company LIKE ? OR chair.summary LIKE ? OR products.name LIKE ? OR products.description LIKE ? ) GROUP BY chair.id_user) UNION (SELECT 2, chair.id_user, chair.company, chair.district, chair.summary, chair.place, products.name FROM chair LEFT JOIN products ON chair.id_user = products.id_user WHERE ( chair.district LIKE ? AND chair.place LIKE ? ) AND ( chair.company LIKE ? OR chair.summary LIKE ? OR products.name LIKE ? OR products.description LIKE ? ) GROUP BY chair.id_user) UNION (SELECT 3, chair.id_user, chair.company, chair.district, chair.summary, chair.place, products.name FROM chair LEFT JOIN products ON chair.id_user = products.id_user WHERE ( chair.district LIKE ? AND chair.place LIKE ? ) AND ( chair.company LIKE ? OR chair.summary LIKE ? OR products.name LIKE ? OR products.description LIKE ? ) GROUP BY chair.id_user) ORDER BY sort_col LIMIT ?, ? </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload