I'm using the audio module and would like to fetch the total number of plays of all of a certain users audio.

When writing it up I used in SQL

SELECT SUM(play_count)
FROM audio
WHERE uid = 1

Only to find out that uid isn't implemented in the audio table.

So I ventured towards towards the node table.

SELECT SUM(play_count)
FROM node
WHERE type = 'audio'

Only to discover that play_count isn't in there? So what the heck am I suppose to do?!

Comments

mike.hobo’s picture

Status: Active » Fixed

Never mind I found the solution in case anyone is wondering how this can be done.

SELECT SUM( audio.play_count )
FROM audio
JOIN node
WHERE audio.nid = node.nid
AND uid =47 

I had to join the tables and match them up and then take the play_count accordingly.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.