Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8985215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:16:58+00:00 2026-06-15T21:16:58+00:00

This query pulls from two separate tables. The video_thumb_chosen has a thumbcolumn that needs

  • 0

This query pulls from two separate tables. The video_thumb_chosen has a thumbcolumn that needs where the mode value needs to be selected.

$query = "SELECT DISTINCT videos.VIDEOID, 
                          videos.title,
                          (
                           select video_thumb_chosen.thumb
                           from video_thumb_chosen
                           where video_thumb_chosen.videoid = videos.VIDEOID 
                           group by video_thumb_chosen.thumb
                           order by count(video_thumb_chosen.thumb) desc limit 1 
                          ) as thumb, 
                          videos.rating, 
                          videos.runtime, 
                          videos.viewcount, 
                          videos.public, 
                          videos.time_added, 
                          videos.HD 
          FROM videos,video_thumb_chosen 
          WHERE videos.active='1' 
             && videos.tube=0  
             && videos.categories <> 7 
          ORDER BY videos.last_viewed desc limit $config[max_viewing_now]"; 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:16:59+00:00Added an answer on June 15, 2026 at 9:16 pm

    Removing the cross join in the from clause would help:

    FROM videos
    

    You are not using video_thumb_chosen in the outer query, so there is no reason to include it.

    There may be other optimizations as well.

    Given what you are doing in MySQL, that will probably fix the problem. Here is the query:

    SELECT videos.VIDEOID, videos.title,
          (select video_thumb_chosen.thumb
           from video_thumb_chosen
           where video_thumb_chosen.videoid = videos.VIDEOID
           group by video_thumb_chosen.thumb
           order by count(video_thumb_chosen.thumb) desc limit 1
          ) as thumb,
          videos.rating, videos.runtime, videos.viewcount, videos.public, videos.time_added, videos.HD
    FROM videos
    where  videos.active='1' && videos.tube=0  && videos.categories <> 7
    ORDER BY videos.last_viewed
    desc limit $config[max_viewing_now]"; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this SQL Query that pulls data from 3 tables. I am unable
I have these two different queries. This query pulls the records from posts table
I have a page that pulls together aggregate data from two different tables. I
I am trying to write some SQL that pulls from several tables using unions,
I created an Entity Framework model that contains two tables from the Northwind database
I'm making a query that pulls a lot of data from a sql table.
I've started developing a site that pulls two images randomly from a database. I
I have a Google Map that pulls data from Fusion Tables and displays it.
I have a fairly complex SQL query that pulls different types of products from
I have this LINQ query (sorry it;s a long one) that query sets from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.