Note that there are some explanatory texts on larger screens.

plurals
  1. POFinding comma separated values with a colon delimiter
    text
    copied!<p>I am setting values in my database for tourneyID,Selected,Paid,Entered,date then separating each selection with a colon</p> <p>So I have a string that may look like this </p> <pre><code> 187,S,,,09-21-2013:141,S,,,06-21-2013:144,S,,,05-24-2013 </code></pre> <p>but it also could look like this </p> <pre><code> 145,S,,,07-12-2013:142,S,,,05-24-2013:187,S,,,09-21-2013 </code></pre> <p>and some times is looks like this</p> <pre><code> 87,S,,,07-11-2013:125,S,,,06-14-2013 </code></pre> <p>I am trying to find this sequence: <code>187,S,,,09-21-2013</code></p> <p>I have data stored like that because I paid a programmer to code it for me. Now, as I learn, I see it was not the best solution, but it is what I have till I learn more and it is working.</p> <p>My problem is when using LIKE it returns both the 187 and 87 values</p> <pre><code> $getTeams = mysql_query("SELECT * FROM teams WHERE (team_tourney_vector LIKE '%$tid,S,P,,$tourney_start_date%' OR team_tourney_vector LIKE '%$tid,S,,,$tourney_start_date%') AND division='$division'"); </code></pre> <p>I tried this using <code>FIND_IN_SET()</code> but it would only return the the team id for this string</p> <pre><code>187,S,,,09-21-2013:141,S,,,06-21-2013:144,S,,,05-24-2013 </code></pre> <p>and does not find the team id for this string</p> <pre><code>145,S,,,07-12-2013:142,S,,,05-24-2013:187,S,,,09-21-2013 SELECT * FROM teams WHERE FIND_IN_SET('187',team_tourney_vector) AND (team_tourney_vector LIKE '%S,,,09-21-2013%') </code></pre> <p>Any thoughts on how to achieve this?</p>
 

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