該查詢從兩個單獨的表中提取。 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