mysql - How to query to get rank of a row? -


I'm creating a photo ranking system Actually, I have three main fields - won, lost, how much went .

Let me assume that I have three photos

  lost photo von --------- ------------ I am going to write a question to get the rank. Every photo problem is that, Photo A and Photo C. There is only one record. How to do a query giving returns for both photos A and C?  
  Photo won lost rank rank -------------------- ----------- A3 2 5 1C3 2 5 1B1405?   

Added 3/17/11

I changed the table structure slightly

so now Instead of "played" I have the "Vote_retio" field, "Vote_retio" holds the value of "Vote_win" / "Vote_logs".

The table should be modified as

  lost photo ratio A3 2 1.5 b1 4 0.25 C3 2 1.5   

What do I want to do:

  1. Only get "Photo A" query and its status.
  2. Check all records and display the rank of each record.

    I can do # 2 with the following question.

      "Select from table order * by ratio"   

    But again there is a problem in photo A and C is the same ratio. I need to make them both rank # 1.

    If you mean the return of 1 ranking as "back 1"? - & gt; However, this combination of group by and group_concat can be done in such a way:

      SELECT Won, Lost, PLAY, GROUP_CONCAT (photo, ',') as your_table group Von, lost, played    

Comments