SQL help!
Posted: Wed Mar 10, 2004 11:47 pm
I'm trying to restore the Play Counter (in case it has been changed) by looking at how many records are in the Played table with each given idSong. I'm able to use COUNT and GROUP BY to write a query of the ids next to how many times they were played. For instance,
But I was unable to use this info to update the PlayCounter field in the Songs table.
Any ideas?
Pablo
Code: Select all
SELECT Songs.ID, timesPlayed
FROM Songs, [SELECT Played.idSong as SID, Count(Played.idSong) AS timesPlayed FROM Played GROUP BY Played.idSong]. AS subq
WHERE Songs.Id =subq.SID;
Any ideas?
Pablo