Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From the <a href="http://dev.mysql.com/doc/refman//5.5/en/select.html" rel="nofollow">fine manual</a>:</p> <blockquote> <p><code>DISTINCT</code> specifies removal of duplicate rows from the result set. [...] <code>DISTINCTROW</code> is a synonym for <code>DISTINCT</code>.</p> </blockquote> <p>So saying this:</p> <pre><code>SELECT DISTINCTROW Email, login_id, user_id ... where SecurityAns = securityans </code></pre> <p>just removes duplicates from the result set but if you have multiple rows with the same <code>SecurityAns</code> and they're all <code>securityans</code>, then your query will return multiple rows. If <code>SecurityAns</code> is an answer to a standard question like "what is your favorite color" or "what was your mother's maiden name" then you should be expecting a lot of duplicates so <code>SecurityAns</code> is certainly not sufficient to guarantee uniqueness.</p> <p>You need to add more to the WHERE clause to guarantee unique results. Or, you could add LIMIT 1 but that's just a bandage over the real problem.</p> <p>You're also probably running into a problem with your WHERE clause:</p> <pre><code>where SecurityAns = securityans </code></pre> <p>the should be true for every row in the table because I think the <code>securityans</code> column name will be used rather than the <code>securityans</code> parameter. Try using a different parameter name. For example, I see your duplicate problem with a procedure like this:</p> <pre><code>create procedure p(in id int, out result int) begin select id into result from t where id = id; end </code></pre> <p>but not with this version:</p> <pre><code>create procedure p(in find_id int, out result int) begin select id into result from t where id = find_id; end </code></pre>
    singulars
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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