title: selecting specific row number from select
body: <p>I'm a beginner at MySQL syntax. So there are a few question I want to ask.</p>
  
  <p>I got a clue DB where users can add in clues. And have a webmethod that select a range of numbers to do random function. (random for the sake of the game, no point doing same clue over and over right?)</p>
  
  <p>But my main problem right now is that <strong>what if the author decided to add in more clues?</strong>
  then my clue db will be looking like this. </p>
  
  <pre><code>+--------+-------------+-----------+--------+
  | cID    | clueDetails |  location | author |
  +--------+-------------+-----------+--------+
  |   1    |      abcde  |   loc 1   | auth 1 |
  |   2    |      efghi  |   loc 1   | auth 1 |
  |   3    |      jklmno |   loc 2   | auth 1 |
  |   4    |      pqrstu |   loc 2   | auth 1 |
  |   5    |      vwxyz  |   loc 1   | auth 1 |
  +--------+-------------+-----------+--------+
  </code></pre>
  
  <p>If the player select <code>loc</code>1 <code>auth 1</code>, it will be showing <code>cID 1,2 and 5</code>. so I couldn't use my random function effectively as it select the first and last of loc and auth and 3 and 4 doesnt fit in. I know right now it's very vague as information are scarce. And to actually understand the whole process, goes right down to the game, and the method/function I have. (which will be very long)</p>
  
  <p>Cutting to the chase, my result will be something as shown below, and the way to identify it will be by cID, but in the event that clue were added in different order ( as shown above) then my function will get rather screw up.</p>
  
  <p>EDIT: assuming this random function give me back 2 clues, because I want to play 2 clues. this random function give me back 1 and 3. so from the table result below, 1 and 3 will give me cID1 and cID5 as they are row number 1 and 3. (sorry for the confusion caused)</p>
  
  <pre><code>+--------+-------------+-----------+--------+
  | cID    | clueDetails |  location | author |
  +--------+-------------+-----------+--------+
  |   1    |      abcde  |   loc 1   | auth 1 |
  |   2    |      efghi  |   loc 1   | auth 1 |
  |   5    |      vwxyz  |   loc 1   | auth 1 |
  +--------+-------------+-----------+--------+
  </code></pre>
  
  <p>So with that, I want to ask if can we select row by its number? e.g <code>row[3] = cID 5, vwxyz, loc 1, auth 1</code>.  </p>
  
  <p>As far as I'm concerned, I've done massive research and there doesn't seem to be any function in MySQL that allow us to select by row number. (though all the article were pretty old dated, 2010 and before. Not sure if MySQL has added in any new function)</p>
  
  <p>I saw a SO thread - <a href="https://stackoverflow.com/questions/2520357/mysql-get-row-number-on-select">MySQL - Get row number on select</a> and from how I see it, it seems to be generating a field called ranking. </p>
  
  <p>What I want to know is, is this field <code>ranking</code> temp or permanent? Because if it's just a temp field, then I could shift the identifier from cID to this numbering.</p>
  
  <p>Or do any of you have any suggestion to go around solving this issue? I thought of clearing the db, and re create the db, but that will be taking too much time. And over time when the DB get large it will be slower as well. And another method is to make a datatable to fill all the current clue where loc=?loc and auth=?auth and add them in again with the new clue(latest), but i figure that will cause the cID to boom and fly at a very fast rate. And I'm afraid this will cause memory management issue / memory leak.</p>
  
  <p>EDIT2: As the create field is just a temp field, and seem to be the only alternative, I tried this MySQL command.</p>
  
  <pre><code>set @rank=0;
  select @rank:=@rank+1 AS rank, cId, clueDetails, location, author from tbl_clue where location = "loc" and author = "auth" order by rank ASC
  </code></pre>
  
  <p>It seem to display what I want, but my command seem different from what other usually give. (more bracket and other stuff). Is my command ok? will there be any indirect implication caused by it?</p>