I am writing code, that returns some video on the given tag from the video, the other video with the same video. It works, but I am trying to make the results random ... so I searched and found that ORDER BY RAND () will be quite slow.
After some time, I found - so I tried to adjust it to my code; Here's my attempt to return a random video:
select r1.id, name, site, site1 from siteID as r1 JOIN (SELECT (RAND) * (SELECT MAX ( Id) from the video)) ADS R2 WHERE r1.id & gt; = R2.id LIMIT 4 And here is my code to find videos with the same code:
select v.name, v.site, v .siteid, v.id Join Video vid video_tag vt ON vt.id_video = v.id WHERE vt.id_tag IN ('1', '2') v.id hing, however, when I keep them together If I try, I get 4 random video matching tags, I just try to get syntax errors with everyone. <<
The following method 4 selects after find out which video has the same tag:
SELECT v.name, v.site, v. Siteid, v.id video video_tag vt on vt .id_video = v.id WHERE vt.id_tag IN ('1', '2') v.id hosting group by COUNT (separate vt.id_ tag) = 2 Order Rand () Border 4; You are already grouped by Video ID, so extra sorting should not affect performance significantly.
No comments:
Post a Comment