F fredrikse Active member Jan 4, 2015 #1 Hi, I need help on two different SQL queries that I would like to run on my DB: 1. Retrieve the top 5 threads for year 2014 which have been viewed the most? 2. Retrieve the top 5 threads for year 2014 which have most answers? Thanks, Fredrik
Hi, I need help on two different SQL queries that I would like to run on my DB: 1. Retrieve the top 5 threads for year 2014 which have been viewed the most? 2. Retrieve the top 5 threads for year 2014 which have most answers? Thanks, Fredrik
Jim Boy Well-known member Jan 4, 2015 #2 I'm not sure about 1.1, but you can try Code: SELECT thread_id, title, reply_count from xf_thread where post_date>unix_timestamp('2014-01-01') order by 3 desc limit 5 and Code: SELECT thread_id, title, view_count from xf_thread where post_date>unix_timestamp('2014-01-01') order by 3 desc limit 5 Upvote 0 Downvote
I'm not sure about 1.1, but you can try Code: SELECT thread_id, title, reply_count from xf_thread where post_date>unix_timestamp('2014-01-01') order by 3 desc limit 5 and Code: SELECT thread_id, title, view_count from xf_thread where post_date>unix_timestamp('2014-01-01') order by 3 desc limit 5
S Syndol Guest Jan 4, 2015 #3 Don't forget AND post_date < UNIX_TIMESTAMP('2015-01-01 00:00:00') Upvote 0 Downvote
F fredrikse Active member Jan 13, 2015 #4 Thank you so much! I will try these queries and hopefully they will work like a charm Upvote 0 Downvote