MySql last ten entries percentage
Hi,
I have a database that I need to extract the last ten entries from and to get a percentage of the how many times the most popular entry was picked from these ten entries. This is currently getting me the most popular entry from the last 10 entries: Code:
$sql = "SELECT data, count( * ) AS Popularity FROM (SELECT data FROM table ORDER BY id DESC LIMIT 10) table GROUP BY data ORDER BY popularity DESC LIMIT 1"; |
I have a select statement in a php script which does something similar. It select the number of "wins" from a "matches" table from a database including league tennis results and prints them out in an echo statement as a percentage.
PHP Code:
|
All times are GMT -5. The time now is 12:09 PM. |