Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL Select statement returning no matches on one column
    text
    copied!<p>I have a VERY basic database that i need to return certain results for.</p> <p>The table i'm searching is called <code>Judge</code> and it contains the columns:</p> <pre><code>Judge_id, Name, Suburb </code></pre> <p>In my select statement I need to return the results of everyone who lives in Adelaide and Sydney.</p> <p>So I use:</p> <pre><code>SELECT * FROM judge WHERE Suburb LIKE ('Adelaide' 'Sydney'); </code></pre> <p>but this returns no results. Also tried:</p> <pre><code>SELECT * FROM judge WHERE Suburb = 'Adelaide' 'Sydney' </code></pre> <p>Still no results.</p> <p>If I only search for just Adelaide however:</p> <pre><code>SELECT * FROM judge WHERE Suburb = 'Adelaide' </code></pre> <p>I get ONE result. However there are multiple matches, and the result that is returned in the last one on the table (if that has anything to do with it).</p> <p>If I do:</p> <pre><code>SELECT * FROM judge WHERE Suburb LIKE '%Adelaide%' </code></pre> <p>I get both matches. But if i leave the % signs out, I only get the one match again.</p> <p>If i do a search for any of the "Name"s of the people in the table, i can get matches back for any of them fine. So why am i having trouble getting a match for Suburb? Thanks for any help</p> <p>EDIT:</p> <p>Table looks like:</p> <pre><code>CREATE TABLE JUDGE ( Judge_id INT NOT NULL, Name VARCHAR(25), Address VARCHAR(25), PRIMARY KEY (Judge_id) ); </code></pre> <p>and data:</p> <pre><code>1 Smith Melbourne 2 Green Cootamundra 3 Gates Dunkeld 4 Smith Sydney 5 Russell Adlaide 6 Schofield Adelaide </code></pre>
 

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