thara Posted November 22, 2011 Share Posted November 22, 2011 I need to create song's top 10 chart in my web site. Im going to add songs to chart using my downloaded system. I count all downloaded through my eb site. to create my top chart i need to find the download average for each song. I tried to find the average using this query but there was a error. $q = "SELECT song_id, song_title, added_date, datediff(now() - interval 7 day, added_date) as date, downloaded/date as average FROM songs ORDER BY downloaded DESC"; can anybody help me.. any ideas are appreciated. thanks.. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted November 22, 2011 Share Posted November 22, 2011 what is the error? Quote Link to comment Share on other sites More sharing options...
thara Posted November 22, 2011 Author Share Posted November 22, 2011 Unknown column 'date' in 'field list' Quote Link to comment Share on other sites More sharing options...
ZulfadlyAshBurn Posted November 22, 2011 Share Posted November 22, 2011 check your database if you have the column called date and its case-sensitive. Quote Link to comment Share on other sites More sharing options...
thara Posted November 22, 2011 Author Share Posted November 22, 2011 I dont hava a column called date in my database. i use it as a alias Quote Link to comment Share on other sites More sharing options...
ZulfadlyAshBurn Posted November 22, 2011 Share Posted November 22, 2011 I seriously don't understand the query o.0 Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted November 22, 2011 Share Posted November 22, 2011 Try this: $q = "SELECT song_id, song_title, added_date, datediff(now() - interval 7 day, added_date) as date, (downloaded / datediff(now() - interval 7 day, added_date)) as average FROM songs ORDER BY downloaded DESC"; Quote Link to comment Share on other sites More sharing options...
thara Posted November 22, 2011 Author Share Posted November 22, 2011 thanks dear.. you saved me from a big headache... Now its ok for me... thank you very much again... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.