该查询从两个单独的表中提取。 video_thumb_chosen有一个需要选择模式值的位置的缩略图列。有没有更快的方法来做组sql查询?
$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]";
多一点点... – Jivan
您正在使用什么数据库指定你的问题? –
使用mysql(ADONewConnection)数据库 – user997101