1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.1 SQL query (view and post count)

Discussion in 'XenForo Questions and Support' started by fredrikse, Jan 4, 2015.

  1. fredrikse

    fredrikse Active Member

    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
     
  2. Jim Boy

    Jim Boy Well-Known Member

    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
    
     
    fredrikse likes this.
  3. Syndol

    Syndol Guest

    Don't forget
    AND post_date < UNIX_TIMESTAMP('2015-01-01 00:00:00')
     
    fredrikse likes this.
  4. fredrikse

    fredrikse Active Member

    Thank you so much! I will try these queries and hopefully they will work like a charm :)
     

Share This Page