此查询从两个单独的表中提取。video_thumb_chosen 有一个拇指列,需要在哪里选择模式值。
$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]";