I have a table called music_lib which has a bunch of columns and over 2000 entries.
id | track_id | total_plays | total_downloads | likes | active | etc | etc
I'm trying to select only the most recent 50 active entries, based on id but I want to order them relative to the combined values (all ints) of the following columns :
total_plays + total_downloads + likes
So basically I want the latest 50 entries ordered by how popular they are (popularity being based on the combined plays, downloads and likes of each entry).
But I have no idea how to formulate this query with PHP / MySQL (using wordpress)..
I know I can get the most recent 50 entries with the following but no idea how to order those results based on the combined figure of the three columns as mentioned above.
$getpodcasts = $wpdb->get_results( "SELECT * FROM music_lib WHERE active = 1 ORDER BY id DESC LIMIT 50");